Login

All Problems

Problem title

Difficulty

Avg time to solve

N-th Fibonacci Number

Moderate

40 mins

Product Of Array Except Self

Easy

26 mins

K Largest Element

Moderate

10 mins

Search In Rotated Sorted Array

Moderate

30 mins

Two Sum

Easy

10 mins

Subset OR

Moderate

20 mins

Find Unique

Easy

--

Average Marks

Easy

5 mins

Count all sub-arrays having sum divisible by k

Moderate

15 mins

Order of People Heights

Ninja

45 mins

Problem

Submissions

88

Avg. time to solve

40 min

Success Rate

70%

Problem Statement

```
F(n) = F(n-1) + F(n-2),
Where, F(1) = F(2) = 1.
```

```
For ‘N’ = 5, the output will be 5.
```

```
The first line contains a single integer ‘T’ denoting the number of test cases to be run. Then the test cases follow.
The first line of each test case contains a single integer ‘N’, representing the integer for which we have to find its equivalent Fibonacci number.
```

```
For each test case, print a single integer representing the N’th Fibonacci number.
Return answer modulo 10^9 + 7.
Output for each test case will be printed in a separate line.
```

```
You are not required to print anything; it has already been taken care of. Just implement the function.
```

```
1 <= T <= 100
1 <= N <= 10^9
Time Limit: 1 sec.
```

```
Can you solve it in Time Complexity better than O(N)?
```

```
2
10
7
```

```
55
13
```

```
For the first test case, the 10th Fibonacci number is 55.
For the second test case, the 7th Fibonacci number is 13.
```

```
2
1
3
```

```
1
2
```

Console

Sample Test Case

Custom Test Case

Download Test Cases

Test Case 1

Test Case 2

Test Case 3

Saving Code...

Full Screen Mode

Change Language

Change Theme

Solution submission not allowed

Save Code

Reset Code