You are viewing a single comment's thread. Return to all comments →
public static int getTotalX(List<int> a, List<int> b) { List<int> GetFactoresMutuos() { var max = b.Min(x => x); List<int> factores = new List<int>(); for (int i = 1; i <= max; i++) { if(b.All(el => el % i == 0)) factores.Add(i); } return factores; } List<int> GetPossiveisR(List<int> factoresParaTestar) { return factoresParaTestar.Where(f => a.All(elA => f % elA == 0)).ToList() ; } var fatores = GetFactoresMutuos(); var possivesR = GetPossiveisR(fatores); return possivesR.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 →