GATE 2023 IN – Question 7
Ankita climbs five stairs from the ground. Each move is one or two stairs upward, and she cannot move down. Let $F(N)$ count the ways to reach stair $N$; $F(1)=1,F(2)=2,F(3)=3$. The value of $F(5)$ is ______.
Practise this question in The GATE Grind →
Show answer and explanation
Correct answer: (A) 8
Explanation
The final move is either one stair from $N-1$ or two from $N-2$.
Thus $F(N)=F(N-1)+F(N-2)$. Starting from 1, 2 gives 3, 5, 8.
Hence $F(5)=8$, **A**.