blob: 37b117ae9152d83c5f57c47dbee7362a0a1c8a76 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
from typing import List
from aoc import BaseAssignment
class Assignment(BaseAssignment):
def parse_item(self, item: str) -> int:
return int(item)
def read_input(self, example = False) -> List[int]:
return list(super().read_input(example))
class AssignmentOne(Assignment):
example_result = 7
def run(self, input: List) -> int:
result = 0
for i in range(1, len(input)):
result += 1 if input[i - 1] < input[i] else 0
return result
class AssignmentTwo(Assignment):
example_result = 5
def run(self, input: List) -> int:
new_input = [
input[i - 2] + input[i - 1] + input[i]
for i in range(2, len(input))
]
return AssignmentOne(path='').run(new_input)
|