Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
var trim = require("lodash/trim");
var max = require("lodash/max");
var dec2bin = function (dec){
return (dec >>> 0).toString(2);
var getLargestBinaryGap = function(n){
return max(
trim(dec2bin(n), "0")
return a.length;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment