Coding interview prep
Most coding interview questions are variations on a small set of patterns. Learn to recognise the pattern and the solution writes itself. Each page below covers when to reach for the pattern, its time and space complexity, a worked walkthrough, a translatable skeleton, a curated problem set, and the mistakes that cost candidates the offer.
Why patterns beat grinding
Solving five hundred random problems teaches you five hundred problems. Learning the dozen patterns underneath them teaches you to solve problems you have never seen, which is exactly what the interview tests. When you read a new question, scan for the tells: a contiguous-subarray ask points to sliding window, a sorted array points to two pointers or binary search, an all-configurations ask points to backtracking. Naming the pattern out loud is also a strong interview signal in its own right.
All patterns
Track a contiguous subarray or substring without re-scanning it from scratch.
6 practice problemsWalk two indices toward or alongside each other to avoid a nested loop.
6 practice problemsHalve the search space each step over any monotonic condition, not just sorted arrays.
6 practice problemsSolve overlapping subproblems once, store the results, and build the answer up.
6 practice problemsExplore level by level with a queue; the natural fit for shortest paths on unweighted graphs.
6 practice problemsGo as deep as possible before backtracking; the backbone of tree and graph exploration.
6 practice problemsBuild candidates incrementally and abandon a partial solution the moment it cannot work.
6 practice problemsKeep the largest or smallest element instantly available without fully sorting.
6 practice problemsStore strings by shared prefixes for fast prefix search and word lookup.
6 practice problemsTrack connectivity between elements with near-constant-time union and find.
6 practice problemsMake the locally optimal choice at each step when it provably yields the global optimum.
6 practice problemsSort by start, then sweep to merge, insert, or detect overlaps.
6 practice problemsAn external resource we recommend. AlgoExpert is not affiliated with us and we earn nothing from this link.
Pair the patterns with the coding and system-design questions for your role, rehearse the behavioral round with worked STAR answers, and when the offer comes, check it against the salary comparison tool.