Minimum One Bit Operations to Make Integers Zero LeetCode solution in Java

1
class Solution {
2
public int minimumOneBitOperations(int n) {
3

4
int inv = 0;
5

6
// xor until n becomes zero
7
for (; n != 0; n = n >> 1) {
8

9
inv ^= n;
10
System.out.println(inv + " " + n);
11
}
12

13
return inv;
14
}
15
}

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0