Interview Questions, Answered by Running Them

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

71 modules Free, no login Updated 15 September 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 71 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. 18Longest palindromic substring
  19. 19Edit distance (Levenshtein)
  20. 20Minimum window substring
  21. 21What is a Python list underneath?
  22. 22Why does [[0]*3]*3 break?
  23. 23Why is `in` slow on a list but fast on a set?
  24. 24Two Sum
  25. 25Maximum subarray sum (Kadane)
  26. 26Remove duplicates from a sorted array in place
  27. 27Rotate an array by k
  28. 28Product of array except self
  29. 29Merge overlapping intervals
  30. 30Find the duplicate number
  31. 31Kth largest element
  32. 32Trapping rain water
  33. 33Sort an array of 0s, 1s and 2s
  34. 343Sum
  35. 35Search in a rotated sorted array
  36. 36Sliding window maximum
  37. 37list vs tuple vs deque vs array — which and why?
  38. 38How does a Python dict work?
  39. 39Why must dictionary keys be hashable?
  40. 40Count things with a dictionary
  41. 41What is the complexity of this code?
  42. 42Design an LRU cache
  43. 43Longest consecutive sequence
  44. 44Subarray sum equals k
  45. 45When should you use a set instead of a list?
  46. 46What happens if you modify a collection while looping over it?
  47. 47Memoisation: caching with a dictionary
  48. 48Implement a hash map from scratch
  49. 49Group records and invert a dictionary
  50. 50Design a stack that reports its minimum in O(1)
  51. 51Evaluate reverse Polish notation
  52. 52Daily temperatures, and the monotonic stack
  53. 53Implement a queue using two stacks
  54. 54Top k frequent elements
  55. 55Merge k sorted sequences
  56. 56Find the median of a data stream
  57. 57Write binary search without an off-by-one
  58. 58First and last position of a target
  59. 59Binary search on the answer, not the array
  60. 60Climbing stairs: the DP that is Fibonacci
  61. 61Coin change, and why greedy is wrong
  62. 62Longest increasing subsequence, twice
  63. 63House robber: the 0-1 choice
  64. 64What does `yield` actually do?
  65. 65Why does this default argument remember?
  66. 66`is` vs `==`, and why 257 is not 257
  67. 67Shallow copy vs deep copy
  68. 68Why do all these functions return the same value?
  69. 69What does a decorator actually replace?
  70. 70What does `with` guarantee when the body raises?
  71. 71Why is a comprehension faster than the same loop?

Other tracks