Two Sum
One pass, complements in a map: check before you insert.
lc-sensei
Every walkthrough Sensei has built: the reasoning, a playable trace, simple Python, and what to say out loud. New here? Start with the install guide.
One pass, complements in a map: check before you insert.
Add one column at a time and let a single carry bit remember everything.
Every palindrome has a center — expand from each one and keep the widest mirror.
Move the shorter wall: only it can unlock a taller future.
Open while opens remain, close only while closes trail opens — every answer is one root-to-leaf path.
Put each useful value in its home slot, then read the first gap.
Fix one slot at a time; every unused number gets a turn, then un-choose.
A bar's height ends where a shorter bar begins.
Keep only future champions: discard what's smaller, evict what's stale, read the front.
Fly the smallest ticket first, fix airports post-order, read the route backwards.
A matching earlier prefix is one valid start; count its frequency before inserting the current sum.
K stops means K+1 edges: relax level by level.
Pool k1+k2 into one budget and spend every move on the current largest gap.