How to handle negative numbers?
Tried the following code which works fine for positive integers.\nGetting an error \'Line 9: Char 23: runtime error: left shift of negative value -2147483648 (s
Tried the following code which works fine for positive integers.\nGetting an error \'Line 9: Char 23: runtime error: left shift of negative value -2147483648 (solution.cpp)\' for a testcase - [-1, 1]\n\n```\nclass Solution {\npublic:\n    int getSum(int a, int b)\n    {\n        while(b!=0)\n        {\n            int carry = a&b;\n            a = a^b;\n            b = (carry << 1);                \n        }\n        return a;\n    }\n};\n```
[]