Skip to content

Instantly share code, notes, and snippets.

@hell0-world
hell0-world / algorithms.js
Last active September 9, 2021 10:59
Basic algorithms in JS
// GCD
// Euclidean algorithm
const gcd = (a,b) => {
if(!b) return a;
return gcd(b, a%b);
}
// LCM
// USING GCD
const lcm = (a,b) =>{