It took 4 steps, therefore the binary gap is 4. In Java, this code becomes: public static int binaryGap(int n) { n |= n - 1; int steps = 0; ...
確定! 回上一頁