C++ with comments
\nclass Solution {\npublic:\n    int getSum(int a, int b) {\n        while (b != 0)  \n        {  \n\n            int carry =  a & b;  //All 1s in carry will re
```\nclass Solution {\npublic:\n    int getSum(int a, int b) {\n        while (b != 0)  \n        {  \n\n            int carry =  a & b;  //All 1s in carry will represent positions \n                                 //where addition will result in to carry\n\n            a = a ^ b;  //sum of a and b without considering carry\n\n            b = (unsigned int)carry << 1;  //typecasting to handle negative number \n                                           //<< 1will shift the carry bits to       \n                                           //the position where these bits are to be added.\n        }  \n        return a;  \n        \n    }\n};\n```
[]