My easy understanding java solution


  • -1
    W

    public class Solution {
    public int getSum(int a, int b) {
    int x=a^b;
    int y=a&b;
    while(y!=0){
    int xx=x;
    int yy=y<<1;
    x=xx^yy;
    y=xx&yy;
    }
    return x;
    }
    }


Log in to reply
 

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