You are viewing a single comment's thread. Return to all comments →
import collections def nonDivisibleSubset(k, s): counts = collections.Counter((i % k for i in s)) return sum((max(counts[r], counts[k - r]) for r in range(k//2 + 1))) \ + (1 - counts[0])*(0 in counts) \ + (1 - counts[k // 2])*(k % 2 == 0)*(k // 2 in counts)
Seems like cookies are disabled on this browser, please enable them to open this website
Non-Divisible Subset
You are viewing a single comment's thread. Return to all comments →