aoc2021/day01.py

26 lines
549 B
Python

from tools.aoc import AOCDay
class Day(AOCDay):
test_solutions_p1 = [7, 1602]
test_solutions_p2 = [5, 1633]
def part1(self):
count = 0
depths = self.getInputListAsType(int)
for x in range(1, len(depths)):
if depths[x] > depths[x-1]:
count += 1
return count
def part2(self):
count = 0
depths = self.getInputListAsType(int)
for x in range(3, len(depths)):
if depths[x] > depths[x-3]:
count += 1
return count