Skip to content

Instantly share code, notes, and snippets.

@jonathanbcsouza
Last active November 1, 2022 09:59
Show Gist options
  • Save jonathanbcsouza/8d32e9781313be9bc9985f298b1e612b to your computer and use it in GitHub Desktop.
Save jonathanbcsouza/8d32e9781313be9bc9985f298b1e612b to your computer and use it in GitHub Desktop.
Multipliers Finder
// Return all sets of two numbers, that multiplied by each other, result in 18
const sub_array = [];
const super_array = [2, 5, 7, 12, 3, 4, 13, 9, 1, 6];
for (let i = 0; i < super_array.length; i++) {
for (let j = 0; j < super_array.length; j++) {
if (super_array[i] * super_array[j] == 18) {
sub_array.push([super_array[i], super_array[j]]);
}
}
}
console.log(sub_array);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment