RK DSA Studio

Lower bound

Find the first sorted-array position whose value is at least the target, or n if none exists.

Remember: First ≥ target.

Example: [1,2,2,5], target 2 → index 1.

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 satisfies the predicate; n is an insertion position, not a valid array element index.

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.