LC 97
Interleaving String
Medium · LC 1–100
Candidate solution routes
Linear dynamic programming
Invariant: After processing i, every state through i equals the true value under its definition, and every future transition reads only these finalized states.
candidate confidence: 0.400 · metadata_only
Bitmask dynamic programming
Invariant: dp[mask] is optimal among all legal sequences producing exactly mask, and transitions start from already-correct smaller states.
candidate confidence: 0.368 · metadata_only
Subsequence dynamic programming
Invariant: Every computed state exactly matches its endpoint/prefix definition and includes all legal final match, skip, or edit actions.
candidate confidence: 0.350 · metadata_only
Grid dynamic programming
Invariant: When cell (r,c) is processed, every predecessor state already meets its definition; the new state aggregates every legal way to enter the cell exactly as required.
candidate confidence: 0.350 · metadata_only
How to use this page
Read the statement and constraints first, then validate recognition signals, invariant, and complexity. Candidate score is not correctness evidence.