โ Coding Interview Prep (LeetCode) learning pathCoding Interview Prep (LeetCode) ยท Module 2 of 10
Problem-solving framework
A repeatable method: understand, plan, code, test, optimise.
๐ Key ideas
- Restate the problem and confirm examples.
- List edge cases: empty input, one element, duplicates, negatives, very large n.
- Start with a brute-force idea and its complexity.
- Improve with a pattern or data structure.
- Code cleanly, then dry-run with examples and edge cases.
๐ก Real-life example: Like solving a maths word problem: read it twice, note what is given, try a simple method, then find a smarter one.
Brute forceSimple solution that tries everything
Dry runTracing code by hand with an example
Edge caseUnusual or extreme input
OptimiseMake faster or use less memory