Binary Search — Reasoning Check

Apply the module invariants, traces, and boundary conditions.


Get every question correct to pass this checkpoint. You can review feedback, revise your answers, and submit again.

1. For the sorted array [-3,-1,2,2,8], what zero-based index does lower_bound(target=2) return, where lower_bound means the first value greater than or equal to the target? Enter one integer.
2. To find the minimum of the distinct rotated array [5,6,1,2,3,4], start with inclusive lo=0, hi=5 and mid=2. Since nums[mid] < nums[hi], which update preserves the answer?

Select one answer.

3. SearchRange must find all occurrences of the largest representable int. Which upper-bound computation avoids overflowing the target?

Select one answer.

4. A matrix-search implementation treats [[1,6,9],[2,7,10]] as one virtual row-major array and applies ordinary binary search. Which diagnosis is correct?

Select one answer.

5. FindPeakElement receives [3,8,4,7,2], with outside neighbors treated as negative infinity. Which statement correctly describes acceptable zero-based outputs?

Select one answer.

6. For sorted arrays A=[2,8] and B=[1,3,5,7], cuts i=1 in A and j=2 in B put three values on the left. What median follows from this valid partition? Enter the numeric value.
Join Discord