// the library
Problems
Not just answers, explainers. Each one builds the intuition, walks the approaches from naive to optimal, and hands you commented solutions in three languages.
Two are free samples. Join free to open all 25.
#1 Two SumNo account neededThe classic warm-up that secretly teaches the most important trade in all of interviewing: spend memory to buy speed.#217 Contains DuplicateThe smallest possible showcase of the set: one pass, one membership check, and an O(nΒ²) problem collapses to O(n).#242 Valid AnagramTwo strings are anagrams exactly when their letter counts match. The problem is a lesson in choosing the right canonical form.#49 Group AnagramsValid Anagram, industrialized: pick a canonical form, use it as a hash key, and grouping happens for free.#347 Top K Frequent ElementsCount, then rank, and the ranking step is where you show range: sort, heap, or the O(n) bucket trick that exploits a bounded key.#238 Product of Array Except SelfDivision is banned, so you learn the real lesson: any 'everything except me' quantity splits into a prefix from the left and a suffix from the right.#125 Valid PalindromeThe gentlest introduction to two pointers, and a quiet test of whether you handle messy input without copying it.#11 Container With Most WaterConverging pointers with a real proof obligation: you must argue that moving the shorter wall never discards the best answer.#15 3SumFix one element and the problem collapses into Two Sum on a sorted array. The real fight is emitting each triplet exactly once.#20 Valid ParenthesesNo account neededThe canonical stack problem: nested structure means last-opened, first-closed, and there's exactly one data structure built for that.#155 Min StackA design problem with one beautiful idea: if a query is expensive to recompute, snapshot the answer at every moment it could change.#739 Daily TemperaturesYour first monotonic stack, the pattern behind every 'next greater element' problem. Learn the invariant once and a whole family of Hards becomes mechanical.#704 Binary SearchEveryone 'knows' binary search; almost everyone ships an off-by-one. This is about writing it with a discipline that makes bugs impossible, not unlikely.#33 Search in Rotated Sorted ArrayBinary search where the array has been cut and swapped. The rescue is one sharp observation: split anywhere, and at least one half is still perfectly sorted.#206 Reverse Linked ListThe pointer-surgery kata. Three pointers, one loop, zero allocations, and the muscle memory you'll reuse inside a dozen harder list problems.#21 Merge Two Sorted ListsThe merge step of merge sort, on pointers, and the home of the dummy-head technique, the single best trick for deleting edge cases from list code.#141 Linked List CycleFloyd's tortoise and hare: detect an infinite loop in O(1) space, and actually understand *why* the two runners are guaranteed to collide.#226 Invert Binary TreeThe famous 'Homebrew author got rejected over this' problem. It's four lines, and the cleanest possible introduction to trusting recursion on trees.#104 Maximum Depth of Binary TreeOne line of recursion that teaches the 'answer from my children's answers' pattern. The template half the Trees track is built on.#98 Validate Binary Search TreeThe problem everyone gets wrong the first time, because the obvious 'check each node against its children' idea is a trap. The fix is passing bounds down.#70 Climbing StairsIt's Fibonacci in a trench coat, and the cleanest possible tour of the whole DP arc: recursion β memoization β tabulation β two variables.#198 House RobberThe canonical take-or-skip DP. One binary decision per element, a two-term recurrence, and the same O(1)-space squeeze as Climbing Stairs.#322 Coin ChangeThe problem that permanently cures greedy overconfidence. Making change with arbitrary denominations demands real DP, one array, one honest recurrence.#200 Number of IslandsThe gateway graph problem: a grid is a graph in disguise, and counting islands is counting connected components with a flood-fill.#146 LRU CacheThe design interview's favorite: O(1) get and put with least-recently-used eviction. Hash map for lookup, doubly linked list for order, neither works alone.