A java solution without tail recursion

  • -1

    public class Solution {
    public int getSum(int a, int b) {
    int sum = a^b;
    int carry = (a&b)<<1;
    int temp = sum;
    sum = temp^carry;
    carry = (temp&carry)<<1;
    return sum;

Log in to reply

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