Algorithms Flashcards

1
Q

Euclid’s Theorem for GCD

A

Greatest_common_divisor#Euclid’s_algorithm
const gcd = (a, b) => (b === 0) ? a : gcd(b, a % b);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Least Common Multiple using Greatest Common Divisor

A

Least_common_multiple#Using_the_greatest_common_divisor
// const lcm = (a, b) => a * b / gcd(a, b);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Using LCM with Multiple Numbers (reduce function)

A

// // LCM of multiple numbers

// return range.reduce((multiple, curr) => lcm(multiple, curr));

How well did you know this?
1
Not at all
2
3
4
5
Perfectly