You are viewing a single comment's thread. Return to all comments →
public static int getTotalX(List<int> a, List<int> b) { List<int> result = []; for (var i = a.Last(); i <= b.Last(); i++) { var isFactorOfA = a.Select(s => i % s).All(v => v == 0); var isFactorOfB = b.Select(s => s % i).All(v => v == 0); if (isFactorOfA && isFactorOfB) result.Add(i); } return result.Count; }
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 →