Skip to content

Number of ways to climb N stairs with a given set of possible steps that can be taken each time. #2541

@kushsharma1001

Description

@kushsharma1001

Problem Statement:

Find the number of ways to climb N stairs with a given set of possible steps that can be taken each time.

Input: N=5, possibleSteps= [1,4]
Output: 3
Explanation: There are only 3 ways to climb 5 stairs when we can take only 1 or 4 steps at a time:
Possibility 1: Taking 1 step first and then taking 4 steps. We have climbed 5 stairs.
Possibility 2: Taking 1 step five times. We have climbed 5 stairs.
Possibility 3: Taking 4 steps first and then taking 1 step. We have climbed 5 stairs.
Since there are only 3 ways. Hence the answer is 3.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions