Compare commits
2 commits
bbefd598a9
...
1e78948bf8
Author | SHA1 | Date | |
---|---|---|---|
1e78948bf8 | |||
3d1bdfdf30 |
5 changed files with 1412 additions and 0 deletions
300
2022/src/day3/input.txt
Normal file
300
2022/src/day3/input.txt
Normal file
|
@ -0,0 +1,300 @@
|
|||
mmbclcsDHCflDDlCrzzrDWjPJvjPvqJPjfpqZQdfWd
|
||||
NNFLnFRNhgNQtMLSFSgwSwGJPZWLPvjpjjJGZJPvWPvJ
|
||||
BnwFNgVVhwNwVQrmzbrrCHVTmDsm
|
||||
CTsVssjPTWPbzhfbfqqpbqJq
|
||||
RRttdQlRdnNpdmwBnBDhFrGrqDGBqJJfJD
|
||||
HttgcggdNwQtgcpTsvjVPTcssjsv
|
||||
bWrpnrpPcFNbfPtwVPddVVDw
|
||||
jLgqqJgjZLhHjRqLHLjqHgftpmJVtTmwQmtGddwwDVJm
|
||||
HhzgshZLpHLjqhLLZRZpLRbbrlBNsrrNsFWcCvvFCcNN
|
||||
PCJJfJhjhzjjdBVBcd
|
||||
RnNnMHnRNtWnBSQHVbqSzFcq
|
||||
ZlnZZZNmLrNrgZmmccGJwGwmGPJs
|
||||
hFZLsjjjMzwPPjqw
|
||||
SQtTcpWWcpMSDlQpDCQJqbHzdSzPzJvPPwqqvH
|
||||
tVfpGWGDVlCGGDCpVWppVcrZFMrnmnLfsrBrnngLmMBh
|
||||
PFPhCmpfhSMWnmgrtgMW
|
||||
RRQdGQvTQRzQDGQTQcRqTTQLvsntnltvrWZlsWlZftntrMtt
|
||||
NQTzfGfzcdTBhPJSNJbCCVhJ
|
||||
sbtqfrqNfcdqsJrfhzQmzhpvzvpQmpNG
|
||||
SHsSDsZVHBHnRZDBZRWSVDnwFhzvphggwGhQzQhgwzmmPzmg
|
||||
jjHVHBlHljMsJjbbCcdttc
|
||||
NccBbvbNZbbvBGPVTGhhlCZCPg
|
||||
tdWHQtLLMrrdWQRqWrMrMrMPsTPThDlTssFFCFCVTDtCDC
|
||||
zzWm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wJhCfVVhmBmVWhHWmWVWqBqMW
|
||||
GjQtgjhPhGgsQjgtthrrvBlvljCrpCdlqBMb
|
||||
RFDHDRFRczzlbqlbvqvHdb
|
||||
DDFcRWTWFbSwRWbGtSGtgPfGGSPPtg
|
60
2022/src/day3/solution.py
Normal file
60
2022/src/day3/solution.py
Normal file
|
@ -0,0 +1,60 @@
|
|||
import string
|
||||
|
||||
|
||||
def parse_input(lines: list[str]) -> list[str]:
|
||||
outputs = []
|
||||
for line in lines:
|
||||
stripped = line.strip()
|
||||
if stripped.isalpha():
|
||||
outputs.append(stripped)
|
||||
return outputs
|
||||
|
||||
|
||||
def find_duplicate(rucksack: str) -> str:
|
||||
first_half = rucksack[: len(rucksack) // 2]
|
||||
second_half = rucksack[len(rucksack) // 2 :]
|
||||
for item in first_half:
|
||||
if item in second_half:
|
||||
return item
|
||||
raise RuntimeError(f"No element in {first_half} present in {second_half}!")
|
||||
|
||||
|
||||
def get_item_priority(item: str) -> int:
|
||||
priorities = {
|
||||
letter: priority
|
||||
for priority, letter in enumerate(string.ascii_letters, start=1)
|
||||
}
|
||||
return priorities[item]
|
||||
|
||||
|
||||
def part1(lines: list[str]) -> int:
|
||||
rucksacks = parse_input(lines)
|
||||
duplicates = [find_duplicate(rucksack) for rucksack in rucksacks]
|
||||
return sum(get_item_priority(duplicate) for duplicate in duplicates)
|
||||
|
||||
|
||||
def find_common_item(rucksacks: list[str]) -> str:
|
||||
if len(rucksacks) <= 1:
|
||||
raise RuntimeError(f"Cannot find common item in {rucksacks}!")
|
||||
first = rucksacks[0]
|
||||
remaining = rucksacks[1:]
|
||||
for item in first:
|
||||
if all(item in rucksack for rucksack in remaining):
|
||||
return item
|
||||
raise RuntimeError(f"No common item found in {rucksacks}")
|
||||
|
||||
|
||||
def part2(lines: list[str]) -> int:
|
||||
rucksacks = iter(parse_input(lines))
|
||||
duplicates = [
|
||||
find_common_item([rucksack, next(rucksacks), next(rucksacks)])
|
||||
for rucksack in rucksacks
|
||||
]
|
||||
return sum(get_item_priority(duplicate) for duplicate in duplicates)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
with open("./input.txt") as file:
|
||||
contents = file.readlines()
|
||||
print(f"Solution to Part 1: {part1(contents)}")
|
||||
print(f"Solution to Part 2: {part2(contents)}")
|
6
2022/src/day4/example.txt
Normal file
6
2022/src/day4/example.txt
Normal file
|
@ -0,0 +1,6 @@
|
|||
2-4,6-8
|
||||
2-3,4-5
|
||||
5-7,7-9
|
||||
2-8,3-7
|
||||
6-6,4-6
|
||||
2-6,4-8
|
1000
2022/src/day4/input.txt
Normal file
1000
2022/src/day4/input.txt
Normal file
File diff suppressed because it is too large
Load diff
46
2022/src/day4/solution.py
Normal file
46
2022/src/day4/solution.py
Normal file
|
@ -0,0 +1,46 @@
|
|||
def get_sections_boundaries(sections: str) -> tuple[int, int]:
|
||||
split = sections.split("-")
|
||||
return int(split[0]), int(split[1])
|
||||
|
||||
|
||||
def parse_input(lines: list[str]) -> list[tuple[tuple[int, int], tuple[int, int]]]:
|
||||
output = []
|
||||
for line in lines:
|
||||
stripped = line.strip()
|
||||
if not stripped.isspace():
|
||||
split = stripped.split(",")
|
||||
output.append(
|
||||
(get_sections_boundaries(split[0]), get_sections_boundaries(split[1]))
|
||||
)
|
||||
return output
|
||||
|
||||
|
||||
def contained(sections1: tuple[int, int], sections2: tuple[int, int]) -> bool:
|
||||
section1_contains_section2 = (
|
||||
sections1[0] <= sections2[0] and sections1[1] >= sections2[1]
|
||||
)
|
||||
section2_contains_section1 = (
|
||||
sections2[0] <= sections1[0] and sections2[1] >= sections1[1]
|
||||
)
|
||||
return section1_contains_section2 or section2_contains_section1
|
||||
|
||||
|
||||
def overlaps(sections1: tuple[int, int], sections2: tuple[int, int]) -> bool:
|
||||
sections1_overlaps_section2 = sections2[0] <= sections1[1] <= sections2[1]
|
||||
sections2_overlaps_section1 = sections1[0] <= sections2[1] <= sections1[1]
|
||||
return sections1_overlaps_section2 or sections2_overlaps_section1
|
||||
|
||||
|
||||
def part1(lines: list[str]) -> int:
|
||||
return sum(contained(*sections) for sections in parse_input(lines))
|
||||
|
||||
|
||||
def part2(lines: list[str]) -> int:
|
||||
return sum(overlaps(*sections) for sections in parse_input(lines))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
with open("input.txt") as file:
|
||||
contents = file.readlines()
|
||||
print(f"Solution for part 1 is: {part1(contents)}")
|
||||
print(f"Solution for part 2 is: {part2(contents)}")
|
Loading…
Reference in a new issue