Prefix Sums & Binary Search Checkpoint

Trace fresh cases, diagnose a failed invariant, then revisit the linked explanation and implementation.


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

1. How many contiguous subarrays of [1,-1,1] sum to 1? Answer with the integer only.
2. Prefix sum is p and target is k. Which prior prefix count contributes to subarrays ending here?

Select one answer.

3. A capacity test can ship within D days at capacity C. What justifies binary search?

Select one answer.

4. An inclusive range addition adds 4 to indices 1..3 in a length-5 difference array. What delta is placed at index 4? Answer with the integer only.
5. A simple grow/shrink sum window is applied to arrays with negative values. Why can it miss solutions?

Select one answer.

6. For a new zero prefix and target 0, code increments its frequency before the lookup. What extra object is counted?

Select one answer.

Join Discord