Trying to solve problem by recursive method, I couldn't develop the top-down approach to solve this simple problem. please help me

This is the problem


this is my solution
https://www.codechef.com/viewsolution/38112148

it is passing the testcases given in problem statements (custom input) but gives WA for some hidden cases and TLE for some.

I am not able to view your solution.

2 Likes

https://www.codechef.com/viewsolution/38112148
also just edited the statement

1 Like