Add sliding-window module: 12 sliding window and two-pointer interview problems, brute-force cross-checks, dry-run traces, operation counts, pitfalls (11 tests)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b6EqSkUWKNBc8i3Q3U
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
Minimum window substring: s="ADOBECODEBANC" t="ABC"
|
||||
===================================================
|
||||
|
||||
right=5 'C' window="ADOBEC" is VALID
|
||||
new best "ADOBEC" (length 6)
|
||||
drop 'A' -> window="DOBEC" no longer valid, missing=1
|
||||
right=10 'A' window="DOBECODEBA" is VALID
|
||||
drop 'D' -> window="OBECODEBA" still valid
|
||||
drop 'O' -> window="BECODEBA" still valid
|
||||
drop 'B' -> window="ECODEBA" still valid
|
||||
drop 'E' -> window="CODEBA" still valid
|
||||
drop 'C' -> window="ODEBA" no longer valid, missing=1
|
||||
right=12 'C' window="ODEBANC" is VALID
|
||||
drop 'O' -> window="DEBANC" still valid
|
||||
drop 'D' -> window="EBANC" still valid
|
||||
new best "EBANC" (length 5)
|
||||
drop 'E' -> window="BANC" still valid
|
||||
new best "BANC" (length 4)
|
||||
drop 'B' -> window="ANC" no longer valid, missing=1
|
||||
|
||||
answer = "BANC"
|
||||
Reference in New Issue
Block a user