Interview Questions, Answered by Running Them

The questions actually asked about strings, lists and dictionaries - each with the code, run in your browser.

29 modules Free, no login Updated 13 August 2026

About this track

Interview answers are not recall problems. "Why is this O(n²)?" is answered properly by showing the count, and "which is faster?" by measuring both - which is what every page here does. Each question gets its own page: the answer in prose, a visualisation that steps through the mechanism, and a real Python interpreter with the implementation already in it.

The track is organised the way the questions are asked - strings, then lists and arrays, then dictionaries, hashing and the complexity traps that catch most candidates. Conceptual questions and coding problems sit side by side, because interviews mix them.

Every other track is organised around ideas. This one is organised around questions, because that is the shape the pressure arrives in: someone asks why your loop is quadratic, and you have thirty seconds. Each page is one question, answered in full and then demonstrated by code you can run.

What you will be able to do

How the track is ordered

The track runs strings, then lists and arrays, then dictionaries, hashing and the crossover problems, finishing on the complexity traps. Within each group the conceptual questions come before the coding problems that lean on them, because "why is `in` slow on a list?" is the answer to half the coding questions that follow it. Nothing here assumes you have read the rest of the site, though the algorithms track covers the same techniques at more length.

Where this leads

The Algorithms and Data Structures track is the long-form version of this one: same techniques, one page per algorithm rather than one page per question, with the visualisation carrying more of the explanation. If a question here lands on something unfamiliar - binary search bounds, hash collisions, dynamic programming - that track has the full treatment.

All 29 modules, in teaching order

  1. 01Why are Python strings immutable?
  2. 02What does slicing a string cost?
  3. 03Does len() count characters or bytes?
  4. 04What is the difference between str and bytes?
  5. 05Why does `is` sometimes work on strings?
  6. 06find() vs index() vs `in` — which one?
  7. 07Reverse a string
  8. 08Check whether a string is a palindrome
  9. 09Are two strings anagrams?
  10. 10Group anagrams together
  11. 11Longest substring without repeating characters
  12. 12First non-repeating character
  13. 13Valid parentheses
  14. 14Run-length string compression
  15. 15Longest common prefix
  16. 16Implement substring search (strStr)
  17. 17Isomorphic strings
  18. 18What is a Python list underneath?
  19. 19Why does [[0]*3]*3 break?
  20. 20Why is `in` slow on a list but fast on a set?
  21. 21Two Sum
  22. 22Maximum subarray sum (Kadane)
  23. 23Remove duplicates from a sorted array in place
  24. 24Rotate an array by k
  25. 25Product of array except self
  26. 26How does a Python dict work?
  27. 27Why must dictionary keys be hashable?
  28. 28Count things with a dictionary
  29. 29What is the complexity of this code?

Other tracks