This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function dec2bin(dec) { | |
return (dec >>> 0).toString(2); | |
} | |
function solution (N) { | |
var nope = 0; | |
if(!N) return nope; | |
var bin = dec2bin(N), clone = [], longest = 0, size; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function equilibrium(a) { | |
var size = (!!a) ? a.length : 0; | |
if (size <= 0) { | |
return -1; | |
} | |
var set = [], | |
sum = 0, | |
lsum = 0, | |
rsum = 0; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Utils = { | |
memo: {}, | |
fibonacci: function (n) { | |
var that = this, val; | |
if (n in that.memo) { | |
return that.memo[n]; | |
} | |
else { | |
if(n === 0 || n === 1) { | |
val = n; |