AlgoFrames

Follow the frames of fact(4)

Standard · Trace the algorithm · about 5 min

Follow fact(4) as frames push and pop. Answer each question before the step plays.

Example 1

Input:

{"n":4}

Output:

24

Constraints

  • The trace uses n = 4.

Learn the idea first: Recursion: base case, recursive case, the call stack, a visual lesson.

More Recursion: base case, recursive case, the call stack problems