Implement Upper Bound
Intuition
The upper bound of a number x
in a sorted array is the index of the first element that is strictly greater than x
. If all elements are less than or equal to x
, the upper bound is the index n
(i.e., where x
would go if appended to the array).
Complexity
Space Complexity
Time Complexity
Code
Last updated