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

Lessons

  1. 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. 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. 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

Module quiz

1. Which step of the interview method comes before writing any code?
2. What does a set give you in a duplicate-check problem?
3. Counting subarrays with a given sum when negative numbers are allowed is best done with...
4. In two sum with a dictionary, why check for the complement before storing the current number?
5. A sorted-list pair sum is too big. What do you do?
6. Which input size forbids an O(n²) solution in Python?

Windows, stacks and binary search ›