You are viewing a single comment's thread. Return to all comments →
java
public static int getTotalX(List<Integer> a, List<Integer> b) { Integer start = Collections.max(a); Integer finish = Collections.max(b); int counter = 0; for (int i = start; i <= finish; i++) { final int j = i; int count1 = (int)a.stream().filter(element -> j % element == 0).count(); int count2 = (int)b.stream().filter(element -> element % j == 0).count(); if (count1 == a.size() && count2 == b.size()) { ++counter; } } return counter; }
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 →
java