Easy · Math

Fibonacci number

Given an integer n with 0 ≤ n ≤ 92, return the Fibonacci number F(n), where F(0) = 0, F(1) = 1 and F(n) = F(n−1) + F(n−2).

Examples

Example 1

n = 7

Output: F(7) = 13

Example 2

n = 0

Output: F(0) = 0

Rebuild it in the studio

Read every interview problem free. Ten rooms need no account. A token opens a problem in full — Pro never counts.

More Math problems