We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Flipping bits
Flipping bits
Sort by
recency
|
779 Discussions
|
Please Login in order to post a comment
def flippingBits(n): num = ~n return 4294967296 + num
Here is my c++ solution, you can watch the video explanation here : https://youtu.be/eZ0lTIzOjhQ
V1
V2
Here is my Python solution!
long flippingBits(uint32_t n) { return ~n; }
2 line Java hackish solution: