Fibonacci Number

Easy · Dynamic Programming · about 5 minutes

Asked at Microsoft, Meta, Amazon, Spotify, Bloomberg, Duolingo, Riot Games, Match Group, Twitch.

The Fibonacci sequence starts 0, 1, and each later term adds up the two terms before it. Return term number n (counting from 0; 0 ≤ n ≤ 30).

Related guides