Merge remote-tracking branch 'origin/master'

# Conflicts:
#	day01.py
This commit is contained in:
Stefan Harmuth 2022-12-10 10:30:24 +01:00
commit 553723520c

View File

@ -13,24 +13,20 @@ class Day(AOCDay):
] ]
] ]
def part1(self): def count(self, step: int = 1) -> int:
count = 0 count = 0
depths = self.getInput(int) depths = self.getInputListAsType(int)
for x in range(1, len(depths)): for x in range(step, len(depths)):
if depths[x] > depths[x-1]: if depths[x] > depths[x - step]:
count += 1 count += 1
return count return count
def part1(self):
return self.count()
def part2(self): def part2(self):
count = 0 return self.count(3)
depths = self.getInput(int)
for x in range(3, len(depths)):
if depths[x] > depths[x-3]:
count += 1
return count
if __name__ == '__main__': if __name__ == '__main__':