Python dictionary and set exercises
Counting, grouping and looking things up with dictionaries and sets, in problems checked by tests in your browser.
Beginner
- 28. Count the VotesThe polls have closed: time to count every ballot30 XP5 min
- 42. First One of a KindIn a crowd of repeats, who showed up only once?40 XP8 min
- 252. Merge Two Contact ListsTwo address books, one tidy list with nobody in it twice40 XP8 min
- 502. Cafe Order TotalRead the menu and add up what the table ordered25 XP4 min
- 529. Who Is Absent?Compare the class list with who showed up today25 XP4 min
- 536. Combine Two Shopping CartsTwo people shop online: put everything into one cart30 XP5 min
- 537. Count Each LetterWhich letters does a sentence use, and how often?30 XP5 min
- 548. Phone Book LookupFind a friend's number, however their name was typed30 XP5 min
- 557. Top ScorerThe game is over: whose name goes at the top of the board?30 XP4 min
- 559. Word-for-Word TranslatorTurn an ordinary sentence into pirate talk30 XP5 min
- 561. Best Score per PlayerEach player's personal best from a pile of results35 XP5 min
- 562. Can We Fill the Order?A shop that refuses to sell its last apples35 XP5 min
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
- 592. Top Scorer of the SeasonThe league table forgets every game but the last65 XP9 min
- 602. Read a Nested SettingDig through settings inside settings with one dotted path70 XP10 min
- 623. GatecrashersA long guest list, a longer queue at the gate: who was never invited?60 XP10 min
- 625. Songs That End on the MinuteTwo songs back to back that finish exactly on the minute75 XP15 min
- 631. Library Lending DeskBooks go out, books come back, and someone always brings one back late170 XP60 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
- Errors and exceptions
- File handling
- Modules and random
- 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.