Lower and upper bound

medium

Plain binary search finds *an* occurrence and cannot tell you how many there are. lowerBound and upperBound can - and their difference is the count, in O(log n).

Worst O(log n)Space O(1)
Loading the lower and upper bound engine…

Where to go next