Given an integer n, return the nth Fibonacci number, where fib(0) = 0, fib(1) = 1, and fib(n) = fib(n-1) + fib(n-2) for n > 1.
Example 1: Input: n = 5 Output: 5
Example 2: Input: n = 10 Output: 55
Constraints: 0 <= n <= 40
Given an integer n, return the nth Fibonacci number, where fib(0) = 0, fib(1) = 1, and fib(n) = fib(n-1) + fib(n-2) for n > 1.
Example 1: Input: n = 5 Output: 5
Example 2: Input: n = 10 Output: 55
Constraints: 0 <= n <= 40
Copyright 2026 Stack Duel. All rights reserved.
Input 1 (integer)
5
Output 1 (integer)
5