x, y and target. In one operation you may flip a single bit in the binary form of x or y, turning a 0 into a 1 or a 1 into a 0. target itself stays as it is.
Return the smallest number of operations needed to make the bitwise OR x | y equal to target.x=3, y=12, target=9 → 2
x = 0011, y = 1100, target = 1001, and currently x | y = 1111. Clear bit 1 of x and bit 2 of y: 2 flips.
x=6, y=6, target=1 → 5
Bits 1 and 2 are set in both numbers, which takes 4 flips, plus one more to set bit 0: 5 in total.
x=5, y=2, target=7 → 0
x=3, y=12, target=9
2
Run checks the first 3 tests in your browser. Submit checks all 78 tests on the server, hidden ones included.