Interview foundations
How a coding interview is run and scored, a six-step method for any problem, and the first two patterns: hash maps and two pointers.
About 4 hours of study
Learning objectives
- Follow the six-step method on an unfamiliar problem
- Trade memory for speed with a hash map or set
- Use two pointers on sorted data and on mirrored text
Lessons
- 1
How coding interviews work
The stages of a technical interview, what interviewers really judge, a six-step method for any problem, and how to talk about time and space complexity.
- 2
Arrays and hashing
Hash maps and sets turn O(n²) searches into O(n): two sum, counting with dictionaries and Counter, grouping anagrams, and prefix sums.
- 3
Two pointers
Two indexes that walk a sorted list or a string from both ends or at different speeds: pair sums, palindromes, the container with the most water, and removing duplicates in place.
Module practice
- Contains a duplicateEasy
- Find the missing numberMedium
- Product of all the othersHard
- First unique characterEasy
- Two sumEasy
- Group the anagramsMedium
- Subarrays with sum kHard
- Valid palindromeEasy
- Container with the most waterMedium
- Triplets that sum to zeroHard