Two Pointers — 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. Sorted two-sum has active values [-4,-1,2,5,9] and target 8. The endpoint sum is 5. Why can the left endpoint -4 be discarded?

Select one answer.

2. What is the maximum container area for heights [4,1,3,2]? Enter one integer.
3. Sort Colors uses the four regions zeros | ones | unknown | twos. It begins with [2,1,1,0], low=0, mid=0, high=3. After its branch for nums[mid]==2, which state preserves those regions?

Select one answer.

4. How many unique zero-sum value triples does [-2,0,0,2,2] contain? Enter one integer.
5. To decide whether s="aba" is a subsequence of t="abxba", a scan has matched "ab" when it reads x. Which state should survive this mismatch?

Select one answer.

6. A valid ASCII-palindrome routine ignores non-alphanumeric bytes but keeps digits. Does "2aA2!" pass? Enter true or false.
Join Discord