You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/** * @param {number} n - a positive integer * @return {number} - a positive integer */varreverseBits=function(n){// reverse nvarans=0;for(vari=0;i<32;i++){ans=ans<<1|(n&1);n=n>>1;}// signed to unsignedvarfans=0;for(i=0;i<32;i++){vartmp=(ans&1)? Math.pow(2,i) : 0;fans+=tmp;ans=ans>>1;}return(fans);};
I tried your code of 190 and it didn't pass.
I recommend my solution:
The text was updated successfully, but these errors were encountered: