Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Common Tail by mini.maus87
def common_tail(a: list[int], b: list[int]) -> int | None:
# your code here
out=None
if a and b:
for k,n in zip(a[::-1],b[::-1]):
if k==n:
out=k
else:
break
return out
print("Example:")
print(common_tail([1, 2, 3, 4], [5, 6, 3, 4]))
assert common_tail([], [1, 2, 3]) == None
assert common_tail([1], [1]) == 1
assert common_tail([3], [1, 2, 3]) == 3
print("The mission is done! Click 'Check Solution' to earn rewards!")
Oct. 1, 2022
Comments: