You are viewing a single comment's thread. Return to all comments →
JavaScript solution:
function flippingBits(n) { const binary32Bits = n.toString(2).padStart(32, 0); const flippedBinary32Bits = [...binary32Bits].map(bit => Number(bit) === 0 ? 1 : 0).join(""); const decimalAfterFlip = parseInt(flippedBinary32Bits, 2); return decimalAfterFlip; }
Seems like cookies are disabled on this browser, please enable them to open this website
Flipping bits
You are viewing a single comment's thread. Return to all comments →
JavaScript solution: