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
depths = self.getInput(int)
for x in range(1, len(depths)):
if depths[x] > depths[x-1]:
depths = self.getInputListAsType(int)
for x in range(step, len(depths)):
if depths[x] > depths[x - step]:
count += 1
return count
def part1(self):
return self.count()
def part2(self):
count = 0
depths = self.getInput(int)
for x in range(3, len(depths)):
if depths[x] > depths[x-3]:
count += 1
return count
return self.count(3)
if __name__ == '__main__':