Your question is Stair Permutations Problem. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
An Equinix Metal provisioning workflow advances through n ordered stages. Each transition may advance by exactly 1 or 2 stages. Given n, return every distinct ordered sequence of moves that reaches stage n exactly.
Sequences are permutations by order, so [1, 2] and [2, 1] are different when both are valid. Return the results in depth-first order, trying a 1-step move before a 2-step move. For n = 0, return [[]], representing the one valid sequence containing no moves.
Implement stair_paths(n):
n, representing the destination stair.1 and 2, and its values sum to n.def stair_paths(n):