## Solution

The solution is based on the formula for the least common multiple of two numbers, $a$ and $b$, below.

$a * b = LCM(a, b) * GCD(a, b)$

$LCM(a, b) = (a * b) / GCD(a, b)$

### Code

Here is an implementation of the challenge. Click the “Run” button to observe the output.

Level up your interview prep. Join Educative to access 80+ hands-on prep courses.