Recursion LeetCode Problems: All 45, With Python Solutions
Every problem in this library that LeetCode tags Recursion — 45 in total, 36 of them with a complete Python solution, a worked example and the time and space complexity of the approach.
- 45 problems
- 9 Easy
- 22 Medium
- 14 Hard
Recursion problems by difficulty
Problems with a complete Python solution are listed first, then by ascending problem number.
Easy (9)
| # | Problem | Difficulty | Topics |
|---|---|---|---|
| 21 | Merge Two Sorted Lists | Easy | Recursion, Linked List |
| 203 | Remove Linked List Elements | Easy | Recursion, Linked List |
| 206 | Reverse Linked List | Easy | Recursion, Linked List |
| 231 | Power of Two | Easy | Bit Manipulation, Recursion, Math |
| 234 | Palindrome Linked List | Easy | Stack, Recursion, Linked List +1 |
| 326 | Power of Three | Easy | Recursion, Math |
| 342 | Power of Four | Easy | Bit Manipulation, Recursion, Math |
| 509 | Fibonacci Number | Easy | Recursion, Memoization, Math +1 |
| 2094 | Finding 3-Digit Even Numbers | Easy | Recursion, Array, Hash Table +2 |
Medium (22)
| # | Problem | Difficulty | Topics |
|---|---|---|---|
| 2 | Add Two Numbers | Medium | Recursion, Linked List, Math |
| 24 | Swap Nodes in Pairs | Medium | Recursion, Linked List |
| 50 | Pow(x, n) | Medium | Recursion, Math |
| 143 | Reorder List | Medium | Stack, Recursion, Linked List +1 |
| 241 | Different Ways to Add Parentheses | Medium | Recursion, Memoization, Math +2 |
| 390 | Elimination Game | Medium | Recursion, Math |
| 394 | Decode String | Medium | Stack, Recursion, String |
| 486 | Predict the Winner | Medium | Recursion, Array, Math +2 |
| 779 | K-th Symbol in Grammar | Medium | Bit Manipulation, Recursion, Math |
| 894 | All Possible Full Binary Trees | Medium | Tree, Recursion, Memoization +2 |
| 1545 | Find Kth Bit in Nth Binary String | Medium | Recursion, String, Simulation |
| 1823 | Find the Winner of the Circular Game | Medium | Recursion, Queue, Array +2 |
| 1922 | Count Good Numbers | Medium | Recursion, Math |
| 1969 | Minimum Non-Zero Product of the Array Elements | Medium | Greedy, Recursion, Math |
| 2487 | Remove Nodes From Linked List | Medium | Stack, Recursion, Linked List +1 |
| 2550 | Count Collisions of Monkeys on a Polygon | Medium | Recursion, Math |
| 247 | Strobogrammatic Number IIPremium | Medium | Recursion, Array, String |
| 255 | Verify Preorder Sequence in Binary Search TreePremium | Medium | Stack, Tree, Binary Search Tree +4 |
| 439 | Ternary Expression ParserPremium | Medium | Stack, Recursion, String |
| 544 | Output Contest MatchesPremium | Medium | Recursion, String, Simulation |
| 776 | Split BSTPremium | Medium | Tree, Binary Search Tree, Recursion +1 |
| 1265 | Print Immutable Linked List in ReversePremium | Medium | Stack, Recursion, Linked List +1 |
Hard (14)
| # | Problem | Difficulty | Topics |
|---|---|---|---|
| 10 | Regular Expression Matching | Hard | Recursion, String, Dynamic Programming |
| 25 | Reverse Nodes in k-Group | Hard | Recursion, Linked List |
| 44 | Wildcard Matching | Hard | Greedy, Recursion, String +1 |
| 60 | Permutation Sequence | Hard | Recursion, Math |
| 224 | Basic Calculator | Hard | Stack, Recursion, Math +1 |
| 233 | Number of Digit One | Hard | Recursion, Math, Dynamic Programming |
| 273 | Integer to English Words | Hard | Recursion, Math, String |
| 736 | Parse Lisp Expression | Hard | Stack, Recursion, Hash Table +1 |
| 761 | Special Binary String | Hard | Recursion, String |
| 1106 | Parsing A Boolean Expression | Hard | Stack, Recursion, String |
| 1808 | Maximize Number of Nice Divisors | Hard | Recursion, Math, Number Theory |
| 248 | Strobogrammatic Number IIIPremium | Hard | Recursion, Array, String |
| 770 | Basic Calculator IV | Hard | Stack, Recursion, Hash Table +2 |
| 772 | Basic Calculator IIIPremium | Hard | Stack, Recursion, Math +1 |
Keep exploring
All LeetCode topicsEvery tag with a page of its own, with the number of problems behind each.LeetCode patternsThe techniques themselves, with a Python template and complexity for each.Curated study listsBlind 75, NeetCode 150 and three more, grouped by pattern.Easy problemsStart here when the data structure is new rather than the problem.
Other topics
- Array1,569
- String672
- Hash Table588
- Math485
- Dynamic Programming481
- Sorting392
- Greedy346
- Depth-First Search289
- Binary Search253
- Database249
- Tree225
- Breadth-First Search223
- Matrix216
- Two Pointers201
- Bit Manipulation194
- Binary Tree174
- Heap (Priority Queue)163
- Prefix Sum157
- Stack157
- Simulation144
- Graph138
- Counting126
- Design122
- Sliding Window116
When the Recursion problem arrives live
Stealth Interview is a desktop app for macOS and Windows. It reads the coding problem off your screen, returns a working solution with a step-by-step explanation and its time and space complexity, and transcribes what the interviewer is saying — while staying invisible to screen sharing.