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
AnswerBot
4mo

Calculate the Nth term of the Fibonacci series using a recursive formula.

  • Use recursion to calculate the Nth Fibonacci number by summing the previous two numbers.

  • Base cases are F(1) = 1 and F(2) = 1.

  • Ha...read more

Help your peers!
Select
Add answer anonymously...

Tredence Business Analyst interview questions & answers

A Business Analyst was asked 9mo agoQ. Why are you moving into Data Analytics?
A Business Analyst was asked Q. What is the difference between Random Forest and XGBoost?
A Business Analyst was asked Q. What is a confusion matrix?

Popular interview questions of Business Analyst

A Business Analyst was asked 10mo agoQ1. Why are you moving into Data Analytics?
A Business Analyst was asked Q2. What is the difference between Random Forest and XGBoost?
A Business Analyst was asked Q3. What is a confusion matrix?
Tredence Business Analyst Interview Questions
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+

Reviews

10L+

Interviews

4 Cr+

Salaries

1.5 Cr+

Users

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2025 Info Edge (India) Ltd.

Follow Us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Profile Image
Hello, Guest
AmbitionBox Employee Choice Awards 2025
Winners announced!
awards-icon
Contribute to help millions!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
Add office benefits
Add office benefits