Practice Real Company Assessment Patterns • Latest 2025–2026 Mock Tests

Programming Exercises

Implement a function to calculate the nth number in the Fibonacci sequence using dynamic programming.

Hard

Problem Statement

Implement a function to calculate the nth number in the Fibonacci sequence using dynamic programming.

Sample Input

n = 10

Sample Output

55

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
// Calculate nth Fibonacci number using dynamic programming function fibonacciDP(n) { // Initialize an array with base cases // Iterate up to n, storing results in the array // Return the nth result } console.log(fibonacciDP(10));
Log in or sign up to run or submit your code.Log inSign up
Input
n = 10
Expected Output
55