Compare commits

..

3 commits

Author SHA1 Message Date
Bruno BELANYI b5425025a6 2024: d02: ex2: add solution 2024-12-02 10:24:02 +00:00
Bruno BELANYI 1e1b96f21c 2024: d02: ex2: add input 2024-12-02 10:23:35 +00:00
Bruno BELANYI b8f01de0d3 2024: d02: ex1: add solution 2024-12-02 10:23:23 +00:00
2 changed files with 4 additions and 0 deletions

View file

@ -13,6 +13,8 @@ def solve(input: list[str]) -> int:
def is_safe(report: Report) -> bool:
def is_increasing_safe(report: Report):
for a, b in itertools.pairwise(report):
if a >= b:
return False
if not 1 <= (b - a) <= 3:
return False
return True

View file

@ -13,6 +13,8 @@ def solve(input: list[str]) -> int:
def is_safe(report: Report) -> bool:
def is_increasing_safe(report: Report):
for a, b in itertools.pairwise(report):
if a >= b:
return False
if not 1 <= (b - a) <= 3:
return False
return True