题目:
题解:
func findComplement(num int) int {highBit := 0for i := 1; i <= 30; i++ {if num < 1<<i {break}highBit = i}mask := 1<<(highBit+1) - 1return num ^ mask
}
题目:
题解:
func findComplement(num int) int {highBit := 0for i := 1; i <= 30; i++ {if num < 1<<i {break}highBit = i}mask := 1<<(highBit+1) - 1return num ^ mask
}