AlgoFrames

Fill the table by hand

Warm-up · Trace the algorithm · about 5 min

The table holds the number of ways to climb to each step, moving 1 or 2 steps at a time. Work out the next cell before the trace writes it. Each cell is the sum of the two cells before it.

Example 1

Input:

{"n":7}

Output:

21

Constraints

  • The table is for n = 7.
  • Answer with whole numbers.

Learn the idea first: Tabulation: filling the table bottom-up, a visual lesson.

More Tabulation: filling the table bottom-up problems