You are viewing a single comment's thread. Return to all comments →
I found similar solution but used the min value from b to loop:
static int getTotalX(int[] a, int[] b) { int result = 0; int min = IntStream.of(b).min().getAsInt(); outer: for ( int j = 1; j <= min; j++ ) { for (int i : b) { if (i % j != 0) { continue outer; } } for (int i : a) { if (j % i != 0) { continue outer; } } result++; } return result; }
Seems like cookies are disabled on this browser, please enable them to open this website
Between Two Sets
You are viewing a single comment's thread. Return to all comments →
I found similar solution but used the min value from b to loop: