Python dictionary and set exercises
Counting, grouping and looking things up with dictionaries and sets, in problems checked by tests in your browser.
Beginner
Intermediate
- 64. Repeats Close TogetherHas anything come back too soon?60 XP10 min
- 77. Two SumSomewhere in the list, two numbers make the target65 XP10 min
- 91. Group the AnagramsSame letters, different words: sort them into families75 XP12 min
- 102. The K Most FrequentWhich values keep turning up more than any others?80 XP14 min
Advanced
- 117. Pairs That Differ by KHow many different pairs sit exactly k apart?110 XP18 min
- 136. Longest Consecutive RunHidden in the jumble: the longest unbroken count125 XP20 min
- 151. Subarrays That Sum to KHow many stretches of the list add up to exactly k?135 XP22 min
- 162. Smallest Rectangle From PointsFour of these dots make a box. How small can it be?150 XP28 min
Expert
- 171. Zero Sum Across Four ListsOne number from each of four lists: how often do they cancel out?190 XP25 min
- 184. Lamps on a Huge GridLamps light rows, columns and diagonals. Is this square in the dark?230 XP40 min
- 188. Most Points on One LineLay a ruler across the dots: how many can it touch at once?240 XP45 min
Other topics
- Python Basics
- Strings
- Lists
- Loops
- Functions
- Math
- Sorting and searching
- Two pointers
- Sliding window
- Stacks and queues
- Recursion and backtracking
- Dynamic programming
- Greedy
- Graphs
- Trees
- Bit manipulation
- Classes
- Iterators and generators
- Parsing
- Simulation
- Python idioms
- Regular expressions
- Codes and ciphers
- Working with data
- Grids and matrices
- Geometry
- Games and puzzles
- Heaps
- Data structures
Or see every challenge, with study plans, today's challenge and duels.