← Search

Micro-Drill #49 — Right boundary (bisect_right)

Search Target: 15s

Right boundary search finds the insertion point after equals. Paired with bisect_left for range counting.

lo, hi = 0, len(a)
while lo < hi:
    mid = lo + (hi - lo) // 2
    if a[mid] <= target: lo = mid + 1
    else: hi = mid
return lo

Type it from memory. Go.

Practice Problems

Related Coding Drills

← Micro #48 Micro #50 →