dynamic programing

https://ide.geeksforgeeks.org/20OSEuPmdk

please convert it to iterative approach