Recursive C solution failure


  • 0
    T

    int getSum(int a, int b) {
    if (a&b == 0)
    return a^b;
    else
    return getSum(a^b, (a&b)<<1);
    }

    Submission Result: Runtime Error

    why?


  • 0
    Q

    You shouldn't use getSum here
    It means you still used plus to solve this problem


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.