Upper bound
Find the first sorted-array position whose value is strictly greater than the target, or n if none exists.
Remember: First > target.
Example: [1,2,2,5], target 2 → index 3.
Time: O(log n). Auxiliary space: O(1).
Formula: First index i with a[i] > target; half-open [low, high)
Up to 15 ascending integers. Return n when no value is greater. upperBound − lowerBound counts occurrences.
Complexities describe the underlying algorithm; tutorial snapshots and rendering can use additional resources.
The interactive workspace loads here when JavaScript is available. You can still browse the learning notes and links above without it.