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

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.

also just edited the statement

1 Like