Skip to content

Instantly share code, notes, and snippets.

@laddered
Created January 28, 2020 08:08
Show Gist options
  • Save laddered/d6fec38d326bc3131db1dcba9e1a266e to your computer and use it in GitHub Desktop.
Save laddered/d6fec38d326bc3131db1dcba9e1a266e to your computer and use it in GitHub Desktop.
function solution(N) {
line=N.toString(2)
arr=line.split('1')
if(arr[arr.length-1]!=''){
arr.pop()
}
arr.sort()
if(arr[arr.length-1]!=''){
return arr[arr.length - 1].length
}
return 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment