Skip to content

Instantly share code, notes, and snippets.

View MichaelKim's full-sized avatar

Michael Kim MichaelKim

View GitHub Profile
@MichaelKim
MichaelKim / generate.js
Last active February 6, 2019 13:38
Generate all possible algebraic formulas (+, -, *, /) from a list of numbers
function flat(arr) {
return arr.reduce((acc, val) => acc.concat(val), []);
}
function isInt(val) {
const num = Number(val);
return Math.abs(num - (0|num)) < 0.000001;
}
function fixRound(val) {