trekhleb / javascript-algorithms

📝 Algorithms and data structures implemented in JavaScript with explanations and links to further readings
MIT License
188.64k stars 30.29k forks source link

Least Common Multiple for a array of elements. #1154

Open abhiphile opened 4 months ago

abhiphile commented 4 months ago

It will be better to also have a leastCommonMultiple function for an array where I could pass an array of elements and get the result.

export default function leastCommonMultiple(a, b) {
  return ((a === 0) || (b === 0)) ? 0 : Math.abs(a * b) / euclideanAlgorithm(a, b);
}
mukund1606 commented 4 months ago

Can I work on this one?

abhiphile commented 4 months ago

Yes Sure !

mukund1606 commented 4 months ago

Created a PR for LCM on array of numbers

AnshDwivedi03 commented 2 months ago

Can i work on it

Vertabrae1 commented 2 months ago

1

Subhrajyoti842 commented 2 months ago

Should I do it?