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.
defnonDivisibleSubset(k,s):# Write your code herelst=[0]*(k+1)res=0fornumins:lst[num%k]+=1print(lst)fornuminrange(math.ceil(len(lst)/2)):ifnum==0ornum==k-num:res+=min(lst[num],1)else:res+=max(lst[num],lst[k-num])print(res)returnres
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 →