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
|
775 Discussions
|
Please Login in order to post a comment
Here is my c++ solution, you can watch the video explanation here : https://youtu.be/eZ0lTIzOjhQ
V1
V2
Python Solution
Solution in JS:
function flippingBits(n) {
}
A simple attempt using C++ bitset
Very simple solution: First perform NOT operation then Mask the number with 32-bit 1's (0xFFFF_FFFF) def FlippingBits(n): a = ~n & 0xFFFFFFFF return a