Type an input and write what you think is the output . Each problem is converted to Web Assembly, so any possible input will show the corresponding output. Only correct predictions count.
Locked until you have predicted 3 outputs correctly.
| 1 | int solution(int a, int b) { |
| 2 | |
| 3 | unsigned int x = a; |
| 4 | unsigned int y = b; |
| 5 | |
| 6 | while (y) { |
| 7 | |
| 8 | unsigned int carry = x & y; |
| 9 | |
| 10 | x = x ^ y; |
| 11 | y = carry << 1; |
| 12 | } |
| 13 | |
| 14 | return (int)x; |
| 15 | } |
Names have been stripped. The signature is the only clue you get for free. Compiled as C++20 with the standard headers and using namespace std; already in scope.