4

Stair Climbing Combination Algorithm

C++ algorithm for showing the ways to climb a stair case.

Usage

./stairclimber [Number of stairs]

Explanation

The algorithm shows every way to climb that number of stairs using 1, 2, or 3 steps at a time.

Example

./stairclimber 3

Solutions:

  • [1 step, 1 step, 1 step]

  • [1 step, 2 steps]

  • [2 steps, 1 step]

  • [3 steps]

Languages

C++