improved day04 (thanks to Heiko)

This commit is contained in:
Ruediger Ludwig 2022-12-04 08:26:11 +01:00
parent 8959d47abe
commit 543d0823c3

View file

@ -31,8 +31,7 @@ class Range:
def overlap(self, other: Range) -> bool: def overlap(self, other: Range) -> bool:
""" Check if this range obverlaps with the other """ """ Check if this range obverlaps with the other """
return (self.start >= other.start and self.start <= other.end) or ( return self.start <= other.end and other.start <= self.end
other.start >= self.start and other.start <= self.end)
@dataclass(slots=True, frozen=True) @dataclass(slots=True, frozen=True)