DYNAMIC PROGRAMMING

https://www.spoj.com/problems/ABA12C/ PROBLEM
https://ide.geeksforgeeks.org/Q2LTT55HLM SOLUTION
GETTING TLE PLEASE HELP

//