Resource · Guide or article
Recursion cheatsheet for coding interviews
Covers recursion problems that are not already part of another named algorithm, with Fibonacci as the running example. Code is in Python.
Reviewed
Open the original: Recursion cheatsheet for coding interviews (opens the original site in a new tab)Practice this topicOpens the practice interviewer in Technical / coding mode; choose a question there.
Add to a roadmap
Keep this resource with a roadmap you follow. It appears as your own extra resource; the roadmap's steps don't change and it doesn't count toward your tracked steps.
Source content: English
Recursion is a method of solving a computational problem where the solution depends on solutions to smaller instances of the same problem.
PrepKit overview
PrepKit editors wrote and reviewed this overview from the source repository. It is not text from the resource itself.
- Suited to
- The source does not state a level
- Format
- Cheatsheet
What it covers
- Base cases and recurrence, including why a call to fib(n - 2) needs two base cases.
- Stack depth risk, Python's default limit of 1000, and why recursion uses stack space unless the language has tail-call optimization.
- Flags generating all permutations and handling duplicates as skills to have.
- Memoization on Fibonacci, removing repeated calls and bringing time to O(n).
How to use it
PrepKit study advice, not a claim made by the source.
Write plain and memoized Fibonacci, count the calls for n = 20 in each, and explain the gap. Then generate all subsets of a short list that contains a duplicate and check your output has no repeats.
Scope and limitations
Backtracking is left as a to-do comment in the source, so the page says little about pruning even though it links backtracking-style problems. One problem is marked LeetCode Premium. Ends with an imported Recommended courses block whose links are not in the recorded file, so PrepKit has not reviewed them.
Access and format
Web page on techinterviewhandbook.org, free to read online in English; the text comes from the MIT-licensed yangshun/tech-interview-handbook repository.
Reviewed by PrepKit on Oct 2, 2026. Listing source commit: e1d28e8886c0
Evidence behind this overview
- apps/website/contents/algorithms/recursion.md
Pages that include this
Get the PrepKit newsletter
Optional. You don't need it to use PrepKit.