dynamic programming

https://ide.geeksforgeeks.org/2BjVdWH8P3 SOLUTION
https://practice.geeksforgeeks.org/problems/painting-the-fence/0 PROBLEM

HOW CAN I OPTIMIZE MY CODE MORE ANY SUGGGESTIONS.

//