Can anyone plz tell me why my code gives tle.On google search most of them have solved it using bottom top dp.↵
[Here's the lonk for problem](https://www.spoj.com/problems/ACPC10D/).Is there any bug in my code or top bottom is slow due to function calls? I have added code in comments thank u.
[Here's the lonk for problem](https://www.spoj.com/problems/ACPC10D/).Is there any bug in my code or top bottom is slow due to function calls? I have added code in comments thank u.