diff options
| author | 2018-12-06 16:55:50 +0100 | |
|---|---|---|
| committer | 2018-12-06 16:55:50 +0100 | |
| commit | afd291f1f91a102982470391e22bd75445083da9 (patch) | |
| tree | d48cdc55fcbc0c0ddf9311a10710b1fe3b12a734 | |
| parent | 64cc2b043a39c7f6b0e8a1acb241be8c8b5cba4e (diff) | |
| download | 2018-master.tar.gz 2018-master.tar.bz2 2018-master.zip | |
| -rw-r--r-- | 2018/aoc/day4.py | 2 | ||||
| -rw-r--r-- | 2018/aoc/day5.py | 5 |
2 files changed, 4 insertions, 3 deletions
diff --git a/2018/aoc/day4.py b/2018/aoc/day4.py index d0b6b74..d703c46 100644 --- a/2018/aoc/day4.py +++ b/2018/aoc/day4.py | |||
| @@ -48,6 +48,6 @@ def main(input_file: list): | |||
| 48 | minutes_slept_most = Counter(minutes_slept).most_common() | 48 | minutes_slept_most = Counter(minutes_slept).most_common() |
| 49 | print(minutes_slept_most) | 49 | print(minutes_slept_most) |
| 50 | 50 | ||
| 51 | print(f'Guard {most_sleepy_guard} slept at minute {minutes_slept_most[0][0]}: {most_sleepy_guard * (minutes_slept_most[0][0] + 1)}') | 51 | print(f'Guard {most_sleepy_guard} slept at minute {minutes_slept_most[0][0]}: {most_sleepy_guard * (minutes_slept_most[0][0])}') |
| 52 | 52 | ||
| 53 | 53 | ||
diff --git a/2018/aoc/day5.py b/2018/aoc/day5.py index f295393..8266fe9 100644 --- a/2018/aoc/day5.py +++ b/2018/aoc/day5.py | |||
| @@ -28,11 +28,12 @@ def reduce_polymer(polymer: str) -> str: | |||
| 28 | 28 | ||
| 29 | def main(input_file: list): | 29 | def main(input_file: list): |
| 30 | polymer = input_file[0] | 30 | polymer = input_file[0] |
| 31 | print(f'Reduced Polymer Length: {len(reduce_polymer(polymer))}') | 31 | reduced = reduce_polymer(polymer) |
| 32 | print(f'Reduced Polymer Length: {len(reduced)}') | ||
| 32 | 33 | ||
| 33 | polymers = [ | 34 | polymers = [ |
| 34 | len(reduce_polymer( | 35 | len(reduce_polymer( |
| 35 | polymer | 36 | reduced |
| 36 | .replace(c, '') | 37 | .replace(c, '') |
| 37 | .replace(c.upper(), '') | 38 | .replace(c.upper(), '') |
| 38 | )) | 39 | )) |
