Talentd
FleetCode
Make and follow sheets.Sign in

Recursion Problems (50)

Problems tagged with Recursion. Start with the easy ones, then move to medium and hard.

10 Easy24 Medium16 Hard

Learn these first

1
Tree

Recursive traversal is the natural way to process tree structures. Concepts like preorder, inorder, and postorder traversal rely heavily on recursion.

2
Stack

Recursion relies on the call stack to store function states. Understanding stack operations helps you visualize recursive calls and convert recursive solutions into iterative ones.

3
Backtracking

Backtracking extends recursion to explore all possible choices in a search space. Learning it helps with permutations, combinations, and constraint-based problems.

4
Divide and Conquer

Many recursive algorithms follow divide-and-conquer patterns where a problem is split into smaller independent subproblems and their results are combined.

5
Dynamic Programming

Many dynamic programming solutions start as recursive definitions and are optimized using memoization or tabulation to avoid repeated computation.

TitleSolutionAcceptDifficultyTopics
Solution49.3%Medium
Linked List, Math +1· 37 companies
Solution68.7%Easy
Linked List, Recursion· 36 companies
Solution70.3%Medium
Linked List, Recursion· 13 companies
Solution67.4%Hard
Linked List, Recursion· 27 companies
Solution32.8%Hard
Dynamic Programming, Greedy +2· 17 companies
50. Pow(x, n)Video
Solution39.0%Medium
Math, Recursion· 22 companies
Solution54.3%Hard
Math, Recursion· 7 companies
143. Reorder ListVideo
Solution66.6%Medium
Linked List, Recursion +2· 15 companies
Solution81.0%Easy
Linked List, Recursion· 34 companies
Solution47.3%Hard
Math, Recursion +2· 25 companies
231. Power of TwoVideo
Solution50.5%Easy
Bit Manipulation, Math +1· 11 companies
Solution39.9%Hard
Dynamic Programming, Math +1· 6 companies
Solution58.8%Easy
Linked List, Recursion +2· 17 companies
247. Strobogrammatic Number IIVideoPremium
Solution53.5%Medium
Array, Recursion +1· 2 companies
Solution34.9%Hard
Math, Recursion +1· 24 companies
326. Power of ThreeVideo
Solution51.4%Easy
Math, Recursion· 6 companies
342. Power of FourVideo
Solution52.5%Easy
Bit Manipulation, Math +1· 8 companies
Solution46.7%Medium
Math, Recursion· 6 companies
394. Decode StringVideo
Solution63.0%Medium
Recursion, Stack +1· 40 companies
439. Ternary Expression ParserVideoPremium
Solution62.6%Medium
Recursion, Stack +1· 1 company
Solution59.7%Medium
Array, Dynamic Programming +3· 6 companies
Solution74.6%Easy
Dynamic Programming, Math +2· 16 companies
544. Output Contest MatchesVideoPremium
Solution77.3%Medium
Recursion, Simulation +1· 1 company
Solution54.1%Hard
Hash Table, Recursion +2· 4 companies
Solution79.4%Hard
Recursion, String· 12 companies
Solution49.8%Hard
Hash Table, Math +3· 3 companies
772. Basic Calculator IIIVideoPremium
Solution53.2%Hard
Math, Recursion +2· 16 companies
776. Split BSTVideoPremium
Solution82.5%Medium
Solution48.7%Medium
Bit Manipulation, Math +1· 7 companies
Solution69.8%Hard
Recursion, Stack +1· 8 companies
Solution73.7%Medium
Recursion, Simulation +1· 5 companies
Solution82.4%Medium
Array, Math +3· 12 companies
Solution58.1%Medium
Math, Recursion· 7 companies
Solution79.8%Easy
Array, Enumeration +2· 3 companies
3565. Sequential Grid Path CoverVideoPremium
Solution59.5%Medium
Showing 1–50 of 50

More about Recursion

Recursion is a fundamental technique in data structures and algorithms where a function solves a problem by calling itself on smaller subproblems. Instead of writing complex loops, recursion breaks a task into simpler pieces until it reaches a base case—a condition where the function stops calling itself. This divide-into-smaller-parts approach makes recursion especially powerful for problems involving hierarchical structures, repeated patterns, and exhaustive exploration.

Recursion is heavily tested in technical interviews because it reveals how well a candidate understands problem decomposition and algorithmic thinking. Many classic interview problems—from generating permutations to traversing trees—are easiest to express recursively. Mastering recursion also prepares you for advanced topics such as Divide and Conquer and Dynamic Programming, both of which build on recursive problem structures.

Common recursion patterns appear across many algorithm categories. For example:

  • Tree traversal problems rely on recursion to explore nodes naturally, which connects closely with Binary Tree and Depth-First Search techniques.
  • Backtracking uses recursion to explore all possible choices while undoing decisions, a key idea in problems like permutations, combinations, and N-Queens. Learn more in Backtracking.
  • Optimization with caching transforms recursive solutions into efficient algorithms using Memoization.

You should use recursion when a problem can be expressed as repeated smaller instances of itself—such as traversing trees, computing combinations, exploring search spaces, or implementing divide-and-conquer algorithms like merge sort. However, recursion must always include a clear base case and careful control of the call stack to avoid infinite recursion or stack overflow.

On FleetCode, you can practice that build your intuition step by step—from simple factorial-style recursion to complex interview questions combining recursion with backtracking, trees, and dynamic programming.

Recursion: common questions

Is Recursion important for FAANG interviews?

Yes. Recursion appears frequently in FAANG interviews, especially in tree traversal, backtracking, and divide-and-conquer problems. Many dynamic programming questions also start with a recursive formulation before optimization.

What is the best way to learn Recursion for DSA?

Start by understanding base cases and the call stack, then practice simple problems like factorial or Fibonacci. Gradually move to tree traversal, subset generation, and backtracking problems, and finally learn how recursion connects to dynamic programming.

What are the most common Recursion patterns in DSA?

Common recursion patterns include divide-and-conquer, backtracking, recursive tree traversal, recursion with memoization, and building solutions using smaller subproblems. Recognizing these patterns helps solve many interview questions quickly.

Why do recursive solutions sometimes cause stack overflow?

Stack overflow occurs when recursion depth becomes too large because each call adds a frame to the call stack. This usually happens when a base case is missing or when recursion runs on very large inputs without optimization.

What are the best Recursion problems for coding interviews?

The best recursion interview problems include factorial and Fibonacci variations, generating permutations or combinations, N-Queens, subset generation, and recursive tree traversals.

How many Recursion problems should I solve to master the topic?

Focus on patterns such as base cases, recursion trees, backtracking, and memoization rather than memorizing solutions.