Practice Find Number of Ways to Reach the K-th Stair
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Find Number of Ways to Reach the K-th Stair
Problem Statement
Alice starts on stair 1 with jump = 0; stair 0 is the bottom of an infinite staircase. She may move down one stair unless she is on stair 0 or her previous move was also down. Alternatively, she may move up 2^jump stairs and then increase jump by 1. Given k, count the distinct finite operation sequences ending on stair k. A sequence may visit k, leave it, and return, and using no operations is allowed.
Source: Find Number of Ways to Reach the K-th Stair on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
k = 0
2
# Example 2
k = 1
4
Constraints
Related LeetCode Problems
Practice more problems similar to Find Number of Ways to Reach the K-th Stair.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.