You've learned classic binary search, lower/upper bounds, and binary search on the answer.
When to use:
- Sorted array lookups
- Boundaries (first/last occurrence)
- Optimization with monotonic feasibility
Key patterns:
- Lower bound: First target
- Upper bound: First target
- On the answer: Binary search feasibility checks
Watch for: Integer overflow in mid, off-by-one in bounds, and infinite loops from wrong rounding.