dynamic_programming.climbing_stairs

Functions

climb_stairs(→ int)

LeetCdoe No.70: Climbing Stairs

Module Contents

dynamic_programming.climbing_stairs.climb_stairs(number_of_steps: int) int

LeetCdoe No.70: Climbing Stairs Distinct ways to climb a number_of_steps staircase where each time you can either climb 1 or 2 steps.

Args:

number_of_steps: number of steps on the staircase

Returns:

Distinct ways to climb a number_of_steps staircase

Raises:

AssertionError: number_of_steps not positive integer

>>> climb_stairs(3)
3
>>> climb_stairs(1)
1
>>> climb_stairs(-7)  
Traceback (most recent call last):
    ...
AssertionError: number_of_steps needs to be positive integer, your input -7