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
Solution68.7%Easy
Linked List, Recursion· 36 companies
Solution81.0%Easy
Linked List, Recursion· 34 companies
231. Power of TwoVideo
Solution50.5%Easy
Bit Manipulation, Math +1· 11 companies
Solution58.8%Easy
Linked List, Recursion +2· 17 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
Solution74.6%Easy
Dynamic Programming, Math +2· 16 companies
Solution79.8%Easy
Array, Enumeration +2· 3 companies
Showing 1–10 of 10

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.