Hackerrank Between Two Sets Java Solution

preview_player
Показать описание
You will be given two arrays of integers and asked to determine all integers that satisfy the following two conditions:

1. The elements of the first array are all factors of the integer being considered
2. The integer being considered is a factor of all elements of the second array
These numbers are referred to as being between the two arrays. You must determine how many such numbers exist.

-~-~~-~~~-~~-~-
Please watch: "CSES problem #4: Increasing Array"
-~-~~-~~~-~~-~-
Рекомендации по теме
Комментарии
Автор

hey, what do You think about this solution?
int counter =0;
for (int i = 1; i <=gdcB; i++) {
int k = lcmA * i;
if (gdcB % k == 0) {
counter++;
}
}

stanisawnagorski
visit shbcf.ru