Please heck wats wrong in the code
Hey @sneha23
U again shared the Wrong code
BTW if u are getting TLE in this ,then its because u cant solve this without DP and this question will be moved to that section soon ,so u can skip this 
oh sorrry:(
yes i wagettng tle only i guess
Then skip it for now , come back to it when u learn DP