AlgoViz
HomeRecursion

Recursion

Choose, recurse, un-choose — patterns that build every path.

0/ 30 understood · 0%
Walkthroughs
11
Problems
30
Start here
30 shown
  1. OverviewBase case, recursive case, the call stackEasy
  2. Fast Exponentiationxⁿ via repeated squaring · O(log n)Medium
  3. Print All SubsequencesTake / don't take at each indexMedium
  4. Subset SumExplore include/exclude, prune on targetMedium
  5. Practice problems
  6. Understand recursion by print something N timesA base case and one smaller callEasy
  7. Print name N times using recursionThe same shape, with a payloadEasy
  8. Print 1 to N using RecursionRecurse first, print on the way backEasy
  9. Print N to 1 using RecursionPrint first, then recurseEasy
  10. Sum of First N Numbersn plus the sum of everything belowEasy
  11. Factorial of a given numbern times the factorial below itEasy
  12. Reverse an arraySwap the ends, recurse inwardEasy
  13. Check if String is Palindrome or NotEnds match, then check the middleEasy
  14. Fibonacci NumberTwo branches, and why they explodeEasy
  15. Recursive Implementation of atoi()Build the number from the frontMedium
  16. Pow(x, n)Square the half powerEasy
  17. Count Good NumbersIndependent choices, multipliedMedium
  18. Sort a stack using recursionPop everything, insert on the way backMedium
  19. Reverse a StackInsert each element at the bottomMedium
  20. Generate Binary Strings Without Consecutive 1sTrack only the previous characterMedium
  21. Generate ParenthesesOpen while you can, close while it stays validMedium
  22. Power SetTake it or leave it, at every elementMedium
  23. Learn All Patterns of Subsequences (Theory)The take / not-take skeletonEasy
  24. Count all subsequences with sum KTake / not-take, returning countsEasy
  25. Check if there exists a subsequence with sum KThe same branch, returning a booleanEasy
  26. Combination SumReuse allowed, so stay on the same indexMedium
  27. Combination Sum IIEach element once, duplicates skipped at each levelMedium
  28. Subsets ITake or skip, collect the leavesMedium
  29. Subsets IISort, then skip duplicates at each levelMedium
  30. Combination Sum IIIk numbers from 1..9, each onceMedium
  31. Letter Combinations of a Phone NumberOne digit per level, a branch per letterHard