more cleanups

This commit is contained in:
Heiko Ludwig 2024-12-02 11:13:59 +01:00
parent d8bd434c0f
commit 107af855b4

View file

@ -20,11 +20,11 @@ def is_safe_single(reports: list) -> bool:
decreasing = True decreasing = True
for i in range(len(reports) - 1): for i in range(len(reports) - 1):
distance = abs(reports[i] - reports[i + 1]) distance = abs(reports[i] - reports[i + 1])
if distance < 1 or distance > 3: if distance == 0 or distance > 3:
return False return False
if reports[i] >= reports[i + 1]: if reports[i] > reports[i + 1]:
increasing = False increasing = False
if reports[i] <= reports[i + 1]: if reports[i] < reports[i + 1]:
decreasing = False decreasing = False
return increasing or decreasing return increasing or decreasing