RunKit + npm:

node v16.5.0
endpointsharetweet
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…