Amazon coding round

yeah , i just found i can apply binary search,lower bound, and upper bound on a set in O(log n).

it’s simple myset.binary_search(key);

same syntax for the rest functions.

it works better than binary_search(myset.begin(),myset.end(),key); for sets and multisets, as in this binary search it will take O(n) for sets and multisets etc.

1 Like