Nth Fibonacci Problem Statement
Calculate the Nth term of the Fibonacci series, denoted as F(n), using the formula: F(n) = F(n-1) + F(n-2)
where F(1) = 1
and F(2) = 1
.
Input:
The first line of each test case contains a real number 'N'.
Output:
For each test case, return the equivalent Fibonacci number.
Example:
Input:
N = 5
Output:
5
Explanation:
The sequence is 1, 1, 2, 3, 5
and the 5th Fibonacci number is 5
.
Constraints:
1 ≤ N ≤ 10000
- Where
N
represents the number for which we have to find its equivalent Fibonacci number. - Time Limit: 1 second
Be the first one to answer
Add answer anonymously...
Top Tredence Business Analyst interview questions & answers
Popular interview questions of Business Analyst
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app