Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for [old] Binary Count by Sim0000
"use strict";
function binaryCount(number){
for(var n = 0; number != 0; number &= number - 1) n++;
return n;
}
var assert = require('assert');
if (!global.is_checking) {
assert.equal(binaryCount(4), 1);
assert.equal(binaryCount(15), 4);
assert.equal(binaryCount(1), 1);
assert.equal(binaryCount(1022), 9);
console.log("Coding complete? Click 'Check' to review your tests and earn cool rewards!");
}
Sept. 21, 2016
Comments: