I\'m new to programming so I have been working through the exercises at CodingBat.com. In the Recursion-2 section, there is a problem I wasn\'t able to solve (recursively) so I
Every recursive function needs an ending point. Yours is:
if (start >= nums.length) return sum1 == sum2;
It will return true or false, depending on (sum1 == sum2).
Refering to the statement:
else {return (A || B); }
It will get into the first clause, until its return TRUE or FALSE. If it returns TRUE, it is the end of the line. Else, it will evaluate the second clause and return the match (A || B).
(TRUE || TRUE) -> TRUE
(TRUE || FALSE) -> TRUE
(FALSE || TRUE) -> TRUE
(FALSE || FALSE) -> FALSE