public int aplusb(int a, int b) {
        // write your code here, try to do it without arithmetic operators.
      while(b!=0){
          int _a = a^b;
          int _b = (a&b)<<1;
          a = _a;
          b = _b;
      }
      return a;
}

/*
111 + 
010 = 1001

_a = 101;
_b = 100;

_a = 001;
_b =1000;

_a = 1001;
_b = 0000*/

results matching ""

    No results matching ""