123: Fibonacci number

Given an integer number (n <= 40), return Fibonacci number

Note: F(0) = 0, F(1) = 1, F(n) = F(n-1) + F(n-2) (n >= 2)

 

Example 1

Input:   5 

Output:  5

Example 2

Input:   6 

Output:  8
Difficulty:Easy
Topic:Dynamic programming
Problem #:123