You are viewing a single comment's thread. Return to all comments →
def numDiv(l: List[Int]) ={ val x = l.min var set = (1 to x).filter(x % _ == 0).toSet l.foreach(i => set = set.filter(i % _ ==0).toSet) set.size }
Works for 9 test cases, but failed on one due to the time limit.
Seems like cookies are disabled on this browser, please enable them to open this website
Common Divisors
You are viewing a single comment's thread. Return to all comments →
Works for 9 test cases, but failed on one due to the time limit.