• + 0 comments

    No need for complex code. Flipping bits meaning is to just get the biggest number in that requested bit and then substract those with the number asked in the question. For ex. : the question wanted a 32 bit, so the max number would be 4294967295. Now to get what the flipping bits of lets say 10 in 32 bit and return it to decimal, just do 4294967295 - 10 which is 4294967285, and there you go the decimal version of its flipping bit.

    Here is in Go

    func flippingBits(n int64) int64 {
        // Write your code here
        return 4294967295 - n
    }