Sliding window finally clicked after I stopped memorizing the template and started asking what's actually shrinking the window
Had the two-pointer template copied into a notes app for months and could apply it maybe half the time under pressure, the other half I'd just stare at the problem trying to remember which pointer moves first. What changed it was a dumb reframe, every sliding window problem is really just "when does keeping this window get worse than shrinking it," nothing about pointers at all. Rewrote four old solved problems using that question instead of the template and three of them I'd apparently been solving by pattern matching without understanding. Still slow on brand new variants but at least I know what I'm looking for now instead of hoping I recognize the shape.
1 comment
- 0
AnonymousAnon This reframe is genuinely helpful, going to try applying it to the problems I've been getting through on memorization instead of actual understanding.