This file contains hidden or 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(count){ | |
if (count % 2 !== 0) { | |
throw Error('Must be even number'); | |
} | |
const result = {}; | |
const length = count / 2; | |
const sums = Array.from({length: Math.pow(9, length) / 2}); | |
const nums = Array.from({length: 10}); | |
const go = (l, m, n) => { |
This file contains hidden or 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(cb, ...params) { | |
const last = params.length - 1; | |
const count = params[last] - 1; | |
function iterate(c, values) { | |
params[c].forEach(function(item) { | |
if (c === count) { | |
cb(...values, item); | |
} else { | |
iterate(c + 1, [...values, item]); |
OlderNewer