Recognize the shape
Patterns reduce the search space
An unfamiliar problem becomes easier when you identify its structure. Sorted input suggests binary search or two pointers. A contiguous range suggests a sliding window or prefix sums. Dependencies suggest a graph.
Pattern recognition does not replace reasoning. It gives you a smaller set of ideas to test against the constraints.
- Two pointers and sliding windows
- Hash maps and prefix sums
- Stacks, queues, and heaps
- Trees, graphs, backtracking, and dynamic programming

A repeatable interview flow
Explain before you optimize
Restate the input, output, constraints, and edge cases. Describe a correct baseline, measure its cost, and then improve the expensive part.
Talk through the invariant while coding. A clear invariant makes the solution easier to verify than a line-by-line narration.
Build durable recall
Use spaced revision instead of one long sprint
Re-solve missed questions after one day, one week, and one month. Change the values or constraints so you must reconstruct the idea.
Track the pattern and failure reason, not only whether the final code passed.
problem: longest-substring-without-repeat
pattern: sliding-window
failed_on: duplicate-removal
review: [tomorrow, next-week, next-month]
Continue learning
Build the complete mental model with the visual lessons, examples, and practice material in the DSA with C++ course.
Explore the course