Python · Lesson 13.3 · Pro

Dictionary tricks

Turn slow nested loops into fast single passes by remembering what you've seen.

In this lesson

  1. Two numbers that add up to a target
  2. Find duplicates
  3. Anagrams
  4. The most frequent item