Removed creation of larger data structure
from typing import Sequence, Optional def missing_integer(sequence: Sequence[int]) -> Optional[int]: for i in range(len(sequence)): if sequence[i] != i + sequence[0]: return i + sequence[0]
- from typing import Sequence, Optional
- def missing_integer(sequence: Sequence[int]) -> Optional[int]:
for x, y in zip(sequence, range(sequence[0], sequence[-1])):if x != y:return y- for i in range(len(sequence)):
- if sequence[i] != i + sequence[0]:
- return i + sequence[0]