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.
def acmTeam(topic):
res=[]
for i in range(len(topic)-1):
a = int(topic[i],2)
for j in range(i+1,len(topic)):
b = int(topic[j],2)
x=bin(a|b)
x=str(x)
res.append(x.count('1'))
return [max(res),res.count(max(res))]
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
ACM ICPC Team
You are viewing a single comment's thread. Return to all comments →
def acmTeam(topic): res=[] for i in range(len(topic)-1): a = int(topic[i],2) for j in range(i+1,len(topic)): b = int(topic[j],2) x=bin(a|b) x=str(x) res.append(x.count('1')) return [max(res),res.count(max(res))]