add day 3
This commit is contained in:
parent
bbefd598a9
commit
3d1bdfdf30
2 changed files with 360 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
|
||||
zzWmMQQLVQrWrbBczNnwNbnpnN
|
||||
THGhBHgHThvnHR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hGgsQjgtthrrvBlvljCrpCdlqBMb
|
||||
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)}")
|
Loading…
Reference in a new issue