From 93d12a41695f62efe126c0c8731289dce88e6ee9 Mon Sep 17 00:00:00 2001 From: Sebastian Seedorf Date: Thu, 2 Dec 2021 12:37:42 +0100 Subject: [PATCH] Day 01 (be more clever) --- day01/part2.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/day01/part2.py b/day01/part2.py index 6a82be5..48676b0 100644 --- a/day01/part2.py +++ b/day01/part2.py @@ -6,9 +6,8 @@ last = [float('inf')] * 3 cnt = 0 for line in lines: - nxt = last[1:] + [line] - if sum(last) < sum(nxt): + if last[0] < line: cnt += 1 - last = nxt + last = last[1:] + [line] print(cnt) \ No newline at end of file