Dynamic Programming can be used to optimize problems by breaking it into subproblems and storing those solutions. If we are looking for the ‘nth’ Fibonacci number we can do that recursively like so.

`function fib(n){`

if(n === 0) return 0

if(n <= 2) return 1

return fib(n…