We use cookies for site analytics. Accept to help us understand how the site is used. See our Privacy Policy for details.
Often the insight is not the algorithm but that sorting first makes an intractable problem a single pass - three-sum, merge intervals, and longest string chain all begin with a sort. Interviewers care that you can name the resulting O(n log n) and justify why the extra pass is free. Custom comparators, and knowing when a counting sort beats a comparison sort, are the senior-level follow-ups.
Order matters, duplicates need grouping, or a custom comparator unlocks a one-pass scan.
15 problems. Each one runs in an in-browser editor against real test cases, with hints and a worked solution.
The patterns cheat sheet covers all of these in one page - what each one looks like in a problem statement, and the template that follows.