We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
counts = [0] * k
for el in s: counts[el%k] += 1
res = min(counts[0], 1)
for i in range(1, k//2+1):
res += 1 if (i == k-i) else max(counts[i], counts[k-i])
return res
Cookie support is required to access HackerRank
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 →