Skip to main content
๐Ÿ“œ WAYPOINT LESSON

Checkpoint โ€” Fuse the Window

โญโญโญ advancedโณ 25 min read๐Ÿ“ Lesson 224 of 281

Bounded-jump collection: the recurrence is easy, surviving n = 200000 with k = 2000 requires the monotonic-deque fusion. The W re-scans its window and dies on budget.

Checkpoint โ€” Fuse the Window. dp[i] = g_i + max over the last k dp values is correct on paper; the naive loop is O(nยทk) โ‰ˆ 4ยท10^8 and fails the budget. The fused monotonic deque answers every window-max in amortized O(1): O(n) total. The W is algorithmically correct โ€” it fails because its complexity family is wrong. That is the mastery point: correctness and survivability are separate theorems.