Count ways to N'th Stair(Order does not matter)
Submissions: 9126   Accuracy:

45.59%

  Difficulty: Medium   Marks: 4

There are N stairs, and a person standing at the bottom wants to reach the top. The person can climb either 1 stair or 2 stairs at a time. Count the number of ways, the person can reach the top (order does not matter).
Note: Order does not matter means for n=4 {1 2 1},{2 1 1},{1 1 2} are considered same.

Input:
The first line contains an integer 'T' denoting the total number of test cases. In each test cases, an integer N will be given.

Output:
For each testcase, in a new line, print number of possible ways to reach Nth stair.

Constraints:
1 <= T <= 1000
1 <= N <= 105

Example:
Input:
1
4
Output:
3

** For More Input/Output Examples Use 'Expected Output' option **

Author: abhiraj26


Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.