I have the same recursion idea, but I make my helper function void type. It turned out that my code can't pass the case[0,1] when I submitted. However, when I used "Run code" with the case, it got the correct result. CONFUSING......
Can anyone find out the problem?
public static int res = 0;