Finding all paths down stairs?

后端 未结 13 1532
天命终不由人
天命终不由人 2020-12-13 07:21

I was given the following problem in an interview:

Given a staircase with N steps, you can go up with 1 or 2 steps each time. Output all possible way

13条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-13 08:22

    may be I am wrong.. but it should be :

    S(1) =0
    S(2) =1
    

    Here We are considering permutations so in that way

    S(3) =3
    S(4) =7
    

提交回复
热议问题