How to find median using this interface?
interface Node {
public long getTotalCount(); // total number of ints on that node
public long getCountGreaterOrEqualTo(int x); // total number of ints on that node that are >= x
public long getCountGreaterOrEqualTo(int x) // total number of ints on that node that are <= x
}
I dont think its possible?
example: if the set is [1,10, 100,500]
My thought process was to use Binary Search and find the left and right bound
for median you can get any number between 11 and 49...
I think the question is incomplete but the interviewer kept insisting its possible.