hint [6/7]
Solution ahead!
type
hint
for next hint :pencil: [Contribute at the FCC Wiki]
function smallestCommons(arr) {
return arr;
}
smallestCommons([1,5]);
Find the smallest number that is evenly divisible by all numbers in the provided range.
more info:
bf details
|bf links
|hint
hint [1/7]
Make sure you've tried to hard to solve it yourself before proceeding. :construction:
type
hint
for next hint :pencil: [Contribute at the FCC Wiki]
hint [1/7]
Make sure you've tried to hard to solve it yourself before proceeding. :construction:
type
hint
for next hint :pencil: [Contribute at the FCC Wiki]
hint [2/7]
This particular problem can be confusing because most people look for the smallest common multiple of the two number but forget the keyword range. This means that if you get [1,5]
then you have to check for the smallest common multiple for all these numbers [1,2,3,4,5] that is evenly divisible by all of them.
type
hint
for next hint :pencil: [Contribute at the FCC Wiki]
hint [3/7]
Create an array with all the numbers that are missing from the original array to make it easier to check when having to check for even division.
type
hint
for next hint :pencil: [Contribute at the FCC Wiki]
hint [4/7]
You can use modulo %
to check if the reminder is 0, which means it is evenly divisible.
type
hint
for next hint :pencil: [Contribute at the FCC Wiki]
hint [5/7]
If you sort the array from greater to lowest then you can check for the first two numbers as it is more likely to the the smallest common multiple than the lower numbers.
type
hint
for next hint :pencil: [Contribute at the FCC Wiki]
hint [1/7]
Make sure you've tried to hard to solve it yourself before proceeding. :construction:
type
hint
for next hint :pencil: [Contribute at the FCC Wiki]
hint [2/7]
This particular problem can be confusing because most people look for the smallest common multiple of the two number but forget the keyword range. This means that if you get [1,5]
then you have to check for the smallest common multiple for all these numbers [1,2,3,4,5] that is evenly divisible by all of them.
type
hint
for next hint :pencil: [Contribute at the FCC Wiki]
hint [3/7]
Create an array with all the numbers that are missing from the original array to make it easier to check when having to check for even division.
type
hint
for next hint :pencil: [Contribute at the FCC Wiki]
hint [4/7]
You can use modulo %
to check if the reminder is 0, which means it is evenly divisible.
type
hint
for next hint :pencil: [Contribute at the FCC Wiki]
hint [5/7]
If you sort the array from greater to lowest then you can check for the first two numbers as it is more likely to the the smallest common multiple than the lower numbers.
type
hint
for next hint :pencil: [Contribute at the FCC Wiki]
hint [6/7]
Solution ahead!
type
hint
for next hint :pencil: [Contribute at the FCC Wiki]
hint [1/7]
Make sure you've tried to hard to solve it yourself before proceeding. :construction:
type
hint
for next hint :pencil: [Contribute at the FCC Wiki]
hint
hint [1/7]
Make sure you've tried to hard to solve it yourself before proceeding. :construction:
type
hint
for next hint :pencil: [Contribute at the FCC Wiki]
hint [2/7]
This particular problem can be confusing because most people look for the smallest common multiple of the two number but forget the keyword range. This means that if you get [1,5]
then you have to check for the smallest common multiple for all these numbers [1,2,3,4,5] that is evenly divisible by all of them.
type
hint
for next hint :pencil: [Contribute at the FCC Wiki]
hint [3/7]
Create an array with all the numbers that are missing from the original array to make it easier to check when having to check for even division.
type
hint
for next hint :pencil: [Contribute at the FCC Wiki]