Compare commits
3 commits
08aab425a2
...
b5425025a6
Author | SHA1 | Date | |
---|---|---|---|
Bruno BELANYI | b5425025a6 | ||
Bruno BELANYI | 1e1b96f21c | ||
Bruno BELANYI | b8f01de0d3 |
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue