Hey, Why do we return low and also why not simply return mid when we encounter a case where the no of pairs with difference <=mid is exactly equal to k because then surely, the k th smallest difference will be mid itself? sharanpreetchadha
Hey, Why do we return low and also why not simply return mid when we encounter a case where the no of pairs with difference <=mid is exactly equal to k because then surely, the k th smallest difference will be mid itself?
Time Complexity: O(nlogn) Space Complexity: O(1) samyakjain
Time Complexity: O(nlogn) Space Complexity: O(1)