CN: Implement upper bound

Problem

Intuition

It is the same as CN: Implement Lower Bound. But with a different condition. If we find a num[mid] > target then we will set the result as mid and move the high towards left, i.e.high = mid-1/

Time Complexity

O(log n)

Space Complexity

O(1)

Solution

Last updated