CoursesDSA Foundations

Recursion

Lessons
9
Exercises
55
Minutes
60

Start What Is Recursion?

  1. 1

    What Is Recursion?

    Understand that recursion is a function solving a problem by calling itself on a smaller version of the problem.

    Complete codeDebugCode orderMultiple choiceTapTrace
    6 exercises
    6 min
  2. 2

    Base Case

    Learn the stopping condition that prevents recursion from running forever.

    Complete codeDebugCode orderMultiple choiceTapTrace
    6 exercises
    6 min
  3. 3

    Recursive Call

    Practice choosing the recursive call that makes progress toward the base case.

    Complete codeDebugCode orderMultiple choiceTapTrace
    6 exercises
    7 min
  4. 4

    Return Value

    Understand how recursive answers come back and combine during unwinding.

    Complete codeDebugCode orderMultiple choiceTapTrace
    6 exercises
    7 min
  5. 5

    Call Stack

    Visualize recursive calls as a stack of waiting function calls.

    Complete codeDebugCode orderMultiple choiceTapTrace
    6 exercises
    7 min
  6. 6

    Recursion Basics CheckpointCheckpoint

    Review base cases, recursive calls, return values, and call stack behavior.

    Complete codeDebugCode orderMultiple choiceTapTrace
    6 exercises
    8 min
  7. 7

    Fibonacci Number

    See how one call can branch into two recursive calls — and why that repeats work.

    Complete codeMultiple choiceTrace
    5 exercises
    5 min
  8. 8

    Recursion ReviewReview

    Mixed recap of the island: base cases, shrinking calls, return propagation, call stack order, and branching.

    Complete codeDebugMultiple choiceTapTrace
    6 exercises
    6 min
  9. 9

    Boss: Pow(x, n)Boss

    Beat the boss with fast exponentiation: halve the exponent to compute pow in O(log n).

    Complete codeCode orderMultiple choiceTrace
    8 exercises
    8 min