Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
~i solution in Clear category for Common Tail by Phil15
from typing import TypeVar
T = TypeVar('T')
def lists_intersect(a: list[T], b: list[T]) -> T | None:
res = None
for i in range(min(len(a), len(b))):
if a[~i] != b[~i]:
break
res = a[~i]
return res
Sept. 8, 2022
Comments: