Write a basic recursive Fibonacci function.

Updated Apr 28, 2026

Short answer

A function that calls itself: F(n) = F(n-1) + F(n-2).

Deep explanation

The Fibonacci sequence is defined by the recurrence relation $F_n = F_{n-1} + F_{n-2}$. A function that calls itself: F(n) = F(n-1) + F(n-2).

Real-world example

Modeling population growth in ideal conditions.

Common mistakes

  • Using a 1-based index when the interviewer expects 0-based.

Follow-up questions

  • What is the 5th Fibonacci number?

More Fibonacci Series interview questions

View all →