#3154

Find Number of Ways to Reach the K-th Stair

master · 1780 · lc hard +32 · 37.5% accepted · 194 likes · top 16%

Description

Given a non-negative integer k, Alice starts on stair 1 with jump = 0. Each step she may go down by 1 (not on stair 0, not two consecutive descents) or go up by 2jump (then increment jump). She may visit stair k multiple times. Return the total number of distinct operation sequences that land on stair k at least once.

Code

1
2
3