Least Common Multiple for a array of elements.

Open
#1,154 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
42/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
javascript
Domain
backend

Research direction

The issue does not name a file or test. Start by locating the existing leastCommonMultiple implementation and its tests, then determine where the array form belongs. Done means an array of elements produces the expected least common multiple and the relevant tests cover the new behavior.

Written by the indexing model from the issue text.

Description

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);
}
Dominant language
JavaScript
Stars
197k
Forks
31k
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from trekhleb/javascript-algorithms

All issues in trekhleb/javascript-algorithms

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.