Day 01 (be more clever)

This commit is contained in:
Sebastian Seedorf
2021-12-02 12:37:42 +01:00
parent 511b3a95d0
commit 93d12a4169

View File

@@ -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)