Ad

This solution avoids creating any objects or creating copies of the sequence or any temporary variables.
Using a class in the previous solutions was silly. >.<

Code
Diff
  • 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
    • class MissingInteger:
    • def __init__(self, sequence):
    • self.sequence = sequence
    • self.perfect_sequence = range(min(self.sequence), max(self.sequence) +1 )
    • from typing import Sequence, Optional
    • def solution(self):
    • for number in self.perfect_sequence:
    • if number not in self.sequence:
    • return number
    • def missing_integer(sequence: Sequence[int]) -> Optional[int]:
    • for x, y in zip(sequence, range(sequence[0], sequence[-1])):
    • if x != y:
    • return y