Merge remote-tracking branch 'origin/master'
# Conflicts: # day01.py
This commit is contained in:
commit
553723520c
20
day01.py
20
day01.py
@ -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__':
|
||||
|
||||
Loading…
Reference in New Issue
Block a user