Problem CLASS ASSIGNMENT

My code is getting TLE . Please Help

Problem:- https://hack.codingblocks.com/contests/c/586/875
my Code:- https://ide.codingblocks.com/s/55876

…Help

Hey Mayank,
This is not a recursion problem but a dynamic programming problem.I suggest you should try to build a recursive relation and optimize the same.