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.
By the way my first attempt timed out on two test cases (whereas iampetermitsel's solution works).
Can somebody help me, how is my solution different from his?
min_b = b[0]
max_a = a[-1]
common_multiples_a = []
elem = max_a
while elem <= min_b:
if all(elem % item == 0 for item in a):
common_multiples_a.append(elem)
elem += max_a
count = 0
for elem in common_multiples_a:
if all(item % elem == 0 for item in b):
count +=1
return count
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Between Two Sets
You are viewing a single comment's thread. Return to all comments →
By the way my first attempt timed out on two test cases (whereas iampetermitsel's solution works). Can somebody help me, how is my solution different from his?