Pick the last balloon inside the interval so the two sides separate.
Warm-up MCQs
1. Which invariant is Longest Common Subsequence?
Source invariant: “When characters match, extend the diagonal: dp[i][j] = dp[i-1][j-1] + 1; otherwise take the better of dropping one character from either string.”
2. A match case sets dp[i][j] = 0. What broke?
Source invariant: “dp[i][j] = edits to turn one prefix into the other: free when characters match, else 1 + min(insert, delete, replace).”
3. Which Decode Ways move is allowed?
Source invariant: “Climbing stairs with a bouncer: a one- or two-digit step only counts when the chunk it consumes is a valid letter code (1-26, no leading zero).”
4. dp[0] stays false in Word Break. What fails?
Source invariant: “dp[i] answers ‘can the first i characters be segmented?’ — true iff some earlier true dp[j] is followed by a dictionary word spanning j to i.”
5. Which decision separates Burst Balloons intervals?
Source invariant: “Decide the LAST balloon to burst in an interval, not the first — with it fixed, the two sides become fully independent subproblems. (Hard — go slow.)”
6. Which pattern fills O(n2) states with O(n) choices?
Source invariant: “Decide the LAST balloon to burst in an interval, not the first — with it fixed, the two sides become fully independent subproblems.”
Self-check gate
Pass tonight only if
For all 3 choices, you state the invariant before code, start from a blank file, and either pass on run one or two or log the exact miss.
Failure path: any failed problem goes into the next revision list with WA: <root cause>. If the failed item is the 2D-grid choice, keep both LCS and Edit Distance in the queue until both recurrences are automatic.