CodeOath
← All posts
Data Structures & Algorithms43 min total · 16 parts

DSA Patterns for Coding Interviews: The Techniques Behind Almost Every Problem

Part 1 of 16 · ~1 min

Overview

Most interview problems aren't actually new. A problem about the longest substring without repeating characters and a problem about the smallest window in a string that contains every character of another string look like they have nothing in common — different phrasing, different constraints, a different "story" wrapped around them — but they're solved with the exact same sliding-window skeleton. That's the real skill being tested in a coding interview: not "have you memorized this specific problem," but "can you recognize which of a fairly small number of patterns this problem actually is." This reference walks through that set of patterns — two pointers and sliding windows, hashing, stacks, recursion and backtracking, tree and graph traversal, binary search in its less obvious form, dynamic programming, greedy algorithms, heaps, and the sorting patterns that go beyond a language's built-in sort — with the concrete signal that should make each one come to mind, plus the mistakes that show up over and over once you start applying them under real interview pressure. Code examples are in JavaScript throughout; the pattern underneath is identical regardless of language. Work through this in order if you're building the whole mental model from scratch, or jump straight to the pattern a specific problem is nudging you toward — and use the decision guide in the final chapter as a cheat sheet once you already know the material and just need the mapping from "problem phrasing" to "pattern."