We're a place where coders share, stay up-to-date and grow their careers.
Bruteforce node solution 🤣
const assert = require('assert'); console.clear(); function findSmallestMultiple(numbers) { function isDividable(num) { for (let i = numbers.length - 1; i >= 0; i--) { if (num % numbers[i] !== 0) return false; } return true; } let counter = 1; while (true) { if (isDividable(counter)) break; counter++; } return counter; } // assert(findSmallestMultiple([7,8,9,10]) === 2520); console.log(findSmallestMultiple([11,12,13,14,15,16,17,18,19,20]));
Please how do i put my code in this snippet like you did when i want to comment with my own answer
Wrap your content with three backtics to render it as a code snippet.
const yourCode = 'here';
Thannk you so much Eugene. This gave me tough time
Bruteforce node solution 🤣
Please how do i put my code in this snippet like you did when i want to comment with my own answer
Wrap your content with three backtics to render it as a code snippet.
Thannk you so much Eugene. This gave me tough time