find the two number in the array of 20 whose product(multiplication) is equal to given number by the user. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

find the two number in the array of 20 whose product(multiplication) is equal to given number by the user.

Javascript use languages

4th Jan 2021, 4:46 AM
shiu sakpal
shiu sakpal - avatar
3 Answers
0
shiu sakpal Post your attempt first to get help from the community ..
4th Jan 2021, 4:52 AM
Alphin K Sajan
Alphin K Sajan - avatar
0
Maybe filter() method would work, I don't understand what you are trying to do so I'm not sure.
4th Jan 2021, 1:24 PM
Karak10
Karak10 - avatar
0
You can put your numbers in the Set, then for each number x check if product / x is in the set. Another way is to keep numbers in a sorted array and use two-pointer linear search.
4th Jan 2021, 4:57 PM
Volodymyr Chelnokov
Volodymyr Chelnokov - avatar