Runkit
Runkit
home page
user forum
new notebook
clone notebook
download notebook
support & documentation
log in
sign up
new notebook
help & feedback
clone this notebook
download this notebook
Sign In
Sign Up
RunKit + npm:
node v16.18.0
endpoint
share
tweet
const input = Buffer.from("@yoursunny"); const bits = []; for (const b of input) { for (let s = 0; s < 8; ++s) { bits.push((b >> s) & 0x01); } } let compares = 0; bits.sort((a, b) => { ++compares; return a - b; }); console.log( `${bits.length} elements`, `${compares} compares`, JSON.stringify(bits), );
Created from: https://npm.runkit.com/
Loading…
Clone and edit this document