DSA Tracker

Topic

Recursion interview questions

All 7 Recursion problems from the curated set, easiest first — a core topic for 11 of the 29 engineering roles.

Easy
3
Medium
4
Hard
0
Sheets
3
Watch the Recursion pattern solved step by step

What Recursion is

Updated 2026-09-09

Recursion is a nesting doll that opens to reveal an identical smaller doll inside. In programming, a function solves a substantial problem by delegating smaller versions of the exact same question to fresh invocations of itself. Each invocation operates on shrunken input until hitting an irreducible foundation called a base case, which returns an immediate answer and permits the waiting cascade to resolve backwards.

When to reach for it

Reach for recursion when a problem possesses self-similar subproblems, such as traversing branched tree structures, exploring graph pathways, or generating combinations. Phrases asking for all permutations, subset generation, exhaustive maze navigation, or hierarchical file system traversals signal recursive decomposition. It is natural whenever the answer to a large instance depends on assembling identical solutions for smaller subsets.

How to think about it

Structure every recursive method around two mandatory stages: the termination stop and the shrinking recurrence. Write the base condition first so the function exits before attempting further execution. Next, trust the recursive call to return valid answers for smaller inputs without mentally unwinding every level at once. Pass accumulation state forward through parameters, or combine child return values on the ascent phase once deeper calls return.

What each operation costs

OperationTime
call stack memory allocation per frameO(d)
traversal of branching recursive call treeO(b^d)
single branch linear recursive unwindO(n)
What usually goes wrong
  • Omitting a base case or writing a condition that input values leap over without triggering, triggering fatal call stack overflow crashes.
  • Modifying shared mutable containers across sibling branches without undoing edits on backtracking steps, contaminating alternative search paths.
  • Recomputing duplicate subproblems inside branching calls without memoizing past returns, causing execution times to explode exponentially.

Every Recursion problem, easiest first

Roles that need Recursion

If you are targeting one of these, Recursion sits early in your path rather than being optional.

Track Recursion in your role's order

Pick your target role and all 370 problems resequence to what that interview actually asks. Free.

Start free

Recursion interview questions, answered

How many Recursion problems should I solve for interviews?

7 curated Recursion problems cover the patterns interviews repeat: 3 easy, 4 medium and 0 hard. They are drawn from 3 widely used sheets, deduplicated, and ordered easiest first.

Is Recursion actually asked in coding interviews?

Yes, though how much depends on the role. Recursion is a core topic for 11 of the 29 engineering roles tracked here, including Frontend Engineer, ML Engineer, Android Developer. For other roles it is lower frequency and belongs later in a study plan.

Which Recursion problem should I start with?

Start with Factorial (Easy). The list on this page is ordered easiest first for that reason, so working top to bottom builds the pattern before the harder variations arrive.

Other topics

Problem set and role mapping as of .