Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Missing Number by juestr
from itertools import pairwise
def missing_number(items: list[int]) -> int:
items.sort()
step = min(b - a for a, b in pairwise(items[:3]))
return next(a + step for a, b in pairwise(items) if a + step != b)
Sept. 9, 2022
Comments: