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.
Simple solution in javascript after shifting the first item off the array
return(~integer>>>0)
Basically it shifts the inverted array to the right, and inputs zero as the sign bit, making the result the equivalent of an unsigned int in other languages.
Cookie support is required to access HackerRank
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 →
Simple solution in javascript after shifting the first item off the array
Basically it shifts the inverted array to the right, and inputs zero as the sign bit, making the result the equivalent of an unsigned int in other languages.