Hi I wrote top-down dp for this problem but my code gets TLE for test case 6 I must change it to bottom-up or there is a trick to don't get TLE?
My code ==> https://mirror.codeforces.com/contest/366/submission/56265597
Problem Link ==> https://mirror.codeforces.com/contest/366/problem/C
Any type of help is appreciated. Thanks in advance.