Day 3
This commit is contained in:
parent
ef4a9f7182
commit
9c6fcba3d1
300
3/input
Normal file
300
3/input
Normal file
@ -0,0 +1,300 @@
|
||||
vGFhvGvvSdfwqhqvmCPnlFPnCNPcCFcWcr
|
||||
ZbWZDMgsTHsrNNLJcJnsJl
|
||||
HbBWQgZVZZBzbgZphwjqpmmVfdGmjG
|
||||
vvCJLGnthChvtrvCCnRbTRqRPRBtbTRfPRRl
|
||||
djZSgHNNwjqcdWlbcbfc
|
||||
pFgMSfpMfzMDZFSgSjGJQQnCvMCVLnnJQLGC
|
||||
gVhQWQpcWZVwwHVvFvnnnnDFdL
|
||||
lzbPlztjltztzSjfGcPdTHLTHFCnnHCLndFGGd
|
||||
jsNbzbczclttSlfbqlljRQMJRMMpJwRZhspZgJRM
|
||||
hLJvfGcNDttSGvJtvSSJcqbqFBBWbjQqDrqbjDDjjb
|
||||
lTswlzZdssgFpdPwZpMQnCjngCCjWBQBWWQqng
|
||||
PRZMpzPZTdVZTfJvFvLFRctJcf
|
||||
JHbQtHVHHLLbTJmmZddgdgwhllMNhhhTgg
|
||||
spqpNGDjDPMhCFChMj
|
||||
DBSDDGnpSDsDWqWczcvSqWvsBtJJLLZrRVZLJRbBZNVrBHrV
|
||||
GwGhfhPhpHccvwSwrTsmsCjDmqTfbDqjss
|
||||
tQntQcNRJMFnnVQFFctJqCsRmsTjjbDqDlTqTbWT
|
||||
NZdVBZZNFzMFNNNvGprZcLGPGrrpcP
|
||||
SvCPLrrlCSvZLrCPPBNPRvNLQBbpmbdggQTTfpfQgpgTqbbb
|
||||
HVjHwMVwWtdMGwtwMwdhDFgbJgJqTmFMfFfmmfTTpq
|
||||
whtHVcjDtHWtsWdwVGVHthDPzRrNSsCRLrLRlZNzZSNzNR
|
||||
rjrlCCBtbtntwPPt
|
||||
FvfJHqBJQWWgWgWLwnMwMLbzvhwTTp
|
||||
WqHgWqBFgGfQgHfVdQFfVfrDllSsRSDmVmRCZZmSSSSZ
|
||||
gjnppCgGHNPrqq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NZV
|
||||
FhFzRTDRPzsRQGQGTFlllrJHjdsJlHMqjjHr
|
||||
LqDcTbmJcqSJSTmnrTcmJrfffplfjZsGZfGGZfQLdplj
|
||||
hWddgBvzWFZfPsQlGh
|
||||
RBWBRCdHtgHttVVzHBVNNNDwSTDcSSSbScDDwbwbnmRS
|
||||
FFPzwlZVVrzFFlFLVlllZdHCHPQMnJQQbhhChdhCbb
|
||||
BRRqGBgRfqvgvBDDDTRgghNCMMTQNNbVJMNJJdbbdT
|
||||
DfpgjGfsRWrFVzwLcs
|
||||
PMTSdSmFjhFpNTqvppvRBrRBrDqB
|
||||
HnZZznJbzGZGlZtZWHlJGcGcwMvQBsrwRDQvcDgrgDgrqRvq
|
||||
HGlGfnJZfMMCfNhm
|
||||
nRssqlqVRppVwdMMQwFgtRFz
|
||||
smTvLLTvvNLtwMMQNg
|
||||
CmPGBvZGWvBSGGDmTZjZlhpJcpHDJsbDnlrrprpl
|
||||
djcQGNQqdGdGqMCgndwgCLDMgW
|
||||
nvBvHpBppnvPPnJTBWLJVMwVfWJfCbfWgW
|
||||
hsHHpBsvRTHpsPszTBTTsRTslGqGqlcqlScnqmhZmmZSZSjl
|
||||
DddBHCmfWCBTDBHTHfMpzhzpJJMJsFrGrz
|
||||
tPVPmbnttjPnZvSvSbnmZPZPNpNGMpJNzzNrGJpvhsshMpFs
|
||||
mwnZcbmmStbVtVjbZVlcLTBlcLCRHRDWCWWW
|
66
3/solution.mjs
Normal file
66
3/solution.mjs
Normal file
@ -0,0 +1,66 @@
|
||||
import { readFileSync } from 'node:fs';
|
||||
|
||||
const input = readFileSync('input', 'utf-8');
|
||||
|
||||
function priorityForItem(item) {
|
||||
const c = item.charCodeAt(0);
|
||||
return c - (c >= 97 ? 96 : 38)
|
||||
}
|
||||
|
||||
const rucksacks = input
|
||||
.split('\n')
|
||||
.filter(line => {
|
||||
if (!line) return false;
|
||||
if (line.length % 2 !== 0) {
|
||||
throw new Error('Rucksack with unequal compartments');
|
||||
}
|
||||
return true;
|
||||
})
|
||||
.map(line => line.split(''))
|
||||
.map(rucksack => ([
|
||||
// compartment 1
|
||||
rucksack.slice(0, rucksack.length / 2),
|
||||
// compartment 2
|
||||
rucksack.slice(rucksack.length / 2)
|
||||
]));
|
||||
|
||||
const sumOfPriorities = rucksacks
|
||||
.map(([compartment1, compartment2]) => {
|
||||
const commonItems = [...new Set(
|
||||
compartment1.filter(item => compartment2.includes(item))
|
||||
)];
|
||||
if (commonItems.length !== 1) {
|
||||
throw new Error('Unexpected number of common items');
|
||||
}
|
||||
return priorityForItem(commonItems[0]);
|
||||
})
|
||||
.reduce((total, priority) => total + priority, 0);
|
||||
|
||||
console.log(`Sum of priorities of common items: ${sumOfPriorities}`);
|
||||
|
||||
const elfRucksackGroups = rucksacks
|
||||
.reduce((groups, rucksack) => {
|
||||
let group = groups[groups.length - 1];
|
||||
if (group.length >= 3) {
|
||||
group = [];
|
||||
groups.push(group);
|
||||
}
|
||||
group.push(rucksack);
|
||||
return groups;
|
||||
}, [[]]);
|
||||
|
||||
const commonItemsInGroup = elfRucksackGroups
|
||||
.map(group => group
|
||||
.reduce((itemsA, itemsB) => {
|
||||
itemsA = [...new Set(itemsA.flat())];
|
||||
itemsB = [...new Set(itemsB.flat())];
|
||||
return itemsA.filter(item => itemsB.includes(item))
|
||||
})
|
||||
)
|
||||
|
||||
const badgePriorities = commonItemsInGroup
|
||||
.map(items => priorityForItem(items[0]))
|
||||
.reduce((total, priority) => total + priority, 0)
|
||||
|
||||
console.log(`Sum of badge priorities: ${badgePriorities}`);
|
||||
|
Loading…
Reference in New Issue
Block a user