Python recursion and backtracking exercises
Problems that contain smaller copies of themselves, solved with recursion and backtracking and checked by tests.
Beginner
Intermediate
- 80. Flatten a Nested DictionarySquash layers of nested settings into a single level70 XP12 min
- 86. Tower of HanoiMove a stack of discs, one at a time, never big on small70 XP15 min
- 104. All Balanced Bracket StringsEvery well-matched arrangement of a few pairs of brackets85 XP15 min
- 274. Phone Keypad WordsWhich words could be hiding behind a phone number?60 XP12 min
- 321. Restore the IP AddressesSomebody lost the dots: which addresses could these digits be?75 XP15 min
Advanced
- 116. Every Subset, No RepeatsAll the different handfuls you can pick from a bag with look-alikes110 XP18 min
- 119. Distinct RearrangementsEvery different order of a list that may hold look-alikes115 XP20 min
- 133. Combinations That Hit the TargetAll the ways to reach a total when every number can be reused125 XP22 min
- 158. Word SearchCan you trace the word through the letter grid?140 XP25 min
- 160. Palindrome PartitionsCut a word into pieces that each read the same both ways145 XP25 min
- 389. Matchstick SquareCan these matchsticks be laid out as a perfect square?140 XP30 min
- 407. Every Way to Read the MessageThe spaces vanished from a message: every way to read it again150 XP30 min
Expert
Other topics
- Python Basics
- Strings
- Lists
- Dictionaries and sets
- Loops
- Functions
- Math
- Sorting and searching
- Two pointers
- Sliding window
- Stacks and queues
- 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.