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?
min_b = b
max_a = a[-1]
common_multiples_a = 
elem = max_a
while elem <= min_b:
if all(elem % item == 0 for item in a):
elem += max_a
count = 0
for elem in common_multiples_a:
if all(item % elem == 0 for item in b):
His is Java Code whereas yours is a python code. It will takes longer to Execute. So sometime that happens.