AlgoFrames

Order of filling

Warm-up · Trace the algorithm · about 4 min

Cell i of the climbing table reads cells i − 1 and i − 2, and cells 0 and 1 are base cases. Drag the five cells into the order a correct tabulation fills them.

Example 1

Input:

{"n":4}

Output:

[0,1,2,3,4]

Constraints

  • The table has cells 0 to 4.

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

More Tabulation: filling the table bottom-up problems