day 3 done

This commit is contained in:
Tanishq Dubey 2022-12-03 20:15:03 -05:00
parent e4b6e71e0b
commit 8d409bcf8f
6 changed files with 477 additions and 0 deletions

86
day3/.gitignore vendored Normal file
View File

@ -0,0 +1,86 @@
node_modules/
.node_modules/
built/*
tests/cases/rwc/*
tests/cases/test262/*
tests/cases/perf/*
!tests/cases/webharness/compilerToString.js
test-args.txt
~*.docx
\#*\#
.\#*
tests/baselines/local/*
tests/baselines/local.old/*
tests/services/baselines/local/*
tests/baselines/prototyping/local/*
tests/baselines/rwc/*
tests/baselines/test262/*
tests/baselines/reference/projectOutput/*
tests/baselines/local/projectOutput/*
tests/baselines/reference/testresults.tap
tests/services/baselines/prototyping/local/*
tests/services/browser/typescriptServices.js
src/harness/*.js
src/compiler/diagnosticInformationMap.generated.ts
src/compiler/diagnosticMessages.generated.json
src/parser/diagnosticInformationMap.generated.ts
src/parser/diagnosticMessages.generated.json
rwc-report.html
*.swp
build.json
*.actual
tests/webTestServer.js
tests/webTestServer.js.map
tests/webhost/*.d.ts
tests/webhost/webtsc.js
tests/cases/**/*.js
!tests/cases/docker/*.js/
tests/cases/**/*.js.map
*.config
scripts/eslint/built/
scripts/debug.bat
scripts/run.bat
scripts/**/*.js
scripts/**/*.js.map
coverage/
internal/
**/.DS_Store
.settings
**/.vs
**/.vscode/*
!**/.vscode/tasks.json
!**/.vscode/settings.template.json
!**/.vscode/launch.template.json
!**/.vscode/extensions.json
!tests/cases/projects/projectOption/**/node_modules
!tests/cases/projects/NodeModulesSearch/**/*
!tests/baselines/reference/project/nodeModules*/**/*
.idea
yarn.lock
yarn-error.log
.parallelperf.*
tests/cases/user/*/package-lock.json
tests/cases/user/*/node_modules/
tests/cases/user/*/**/*.js
tests/cases/user/*/**/*.js.map
tests/cases/user/*/**/*.d.ts
!tests/cases/user/zone.js/
!tests/cases/user/bignumber.js/
!tests/cases/user/discord.js/
tests/baselines/reference/dt
.failed-tests
TEST-results.xml
package-lock.json
tests/cases/user/npm/npm
tests/cases/user/TypeScript-React-Starter/TypeScript-React-Starter
tests/cases/user/TypeScript-Node-Starter/TypeScript-Node-Starter
tests/cases/user/TypeScript-React-Native-Starter/TypeScript-React-Native-Starter
tests/cases/user/TypeScript-Vue-Starter/TypeScript-Vue-Starter
tests/cases/user/TypeScript-WeChat-Starter/TypeScript-WeChat-Starter
tests/cases/user/create-react-app/create-react-app
tests/cases/user/fp-ts/fp-ts
tests/cases/user/webpack/webpack
tests/cases/user/puppeteer/puppeteer
tests/cases/user/axios-src/axios-src
tests/cases/user/prettier/prettier
.eslintcache

300
day3/inp Normal file
View File

@ -0,0 +1,300 @@
LdHVLDLDdHdtLMhcqCqGWcWg
ZZQZSZnnJrQrJQJbfzfnWGWPWMcChMMPcqMnhFcF
ZrzpWzfbpQpWbzvZWZpdtVtDNmRHNVptNDHt
gzCjffWZCtCfZZVdqVSqJdvJndSt
hMHLcmGLMLhHmsRMsSvsQSqrsrlJTTdV
NPNGRGHGHNLczNzzZFWSFFCC
VSBpcvNNbNWWSfGRwtJnRtrzzGzGGn
jZlhTlQLHFLLZbwrzQQsttDtbs
hmmPFlhLmhLMgFMFLbMBBgcNVcfNCcfSVSSNBq
jRDSzjCjjMRMrHzMRCDHMDjBnlQbbnQwLwrNLPwnTPQrlc
sZBqdZqsWgFBpgppGJqllPllwnbQwTwsswQPwN
gJgtJJBtqJqWBGzjRCHDDzRmDtVV
GRBWbbWnGNhbwSsfPfmrlslWsS
HLVCgCLpMgcLVDcDCgmlvstSlsstPtSSSlscvl
LzQDQzMMzJzFQVDJgCzJHJZRZBNbqGFhNFwBGhbhBhBm
JNsHhdPZSdZJjSHzzNwvwGgBFmBmvptJbFvm
WrDrwqqqQWVMCvMvGbGbbFFbFp
rqqLncqnlCncwQWCwWlLfSZPsZddfzzNNdhdPlZz
rwfrwHqSdRcgwdZrDcrqDDdgNzjNjPzPJNJPtbNPbGsHNGHv
hllLMTLLQMCzJssPsTvtFG
QtQnpWVVMVWnVQpRZSSwZDggrcSq
FD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sQttjvGrJccmdGGcrNdRNmG
pHpzPpQHpsPzPlzlbSgSSMLwzh
fCQDLlDQTSjbHDqH
ZhrsrZZZhcclwNswGGwbwF
rcWhlhlpMJpMZmgtBCzCttCCRfdp
zLnCMLNTvtGNpNvNjhRHgZhHvZdZHdjD
fSsWWqScTfJJqfJFFJwswhdHhhhdhDdjbjZbhhDj
WsWmfcqBWfTfsrntrLmplCLttm
ljssbqMMPbHPlsbcWZNLLsWJWRFvvZfW
SzgggDDwTzrQmDQgdSSWvdJLFGffRvZG
zCzCDCrznnTTmCbbpvlPHtCPtb
TZSwNPpcgpNPbwbhhbwrwJqh
BlCDtvvgLWGCLffGfLzLrMqnnbDDHbmnnnJrhnVJ
lzBjdCjCGCjfGjjLGBGGjlCSsRppcdpRNdRSPQcRPQZTgT
TsFTrvGmZGfvZfZFzNNZrhClmRcBgCMwQwQPCPMPRP
bpnnVVJtSDgRBwbQRwlR
jpSnqLpqDJDJLDjWDWLWvvzfZZvqvNsGTHGGFfZl
bzbzznqfCpzvhCSMfbCbpCFhtHGHHJdtHJGhFsmshJJG
DLWRLjRrmNPQjZZlQPsFGFggVcWcFddggdsg
rjrZPwwDRlLLBjQlRRlPDpmbqzpqnnCSCfTMwMqSvC
FmcGcjLRPjQwQjMQrwHQ
btJzJbVNdBJJtzTdGBbdBztGrQhhQWhMwHrhrHSHgHQfhMVS
JJDpdDTtCtzNptnTJBznnvLCCvcFqsRqFcvZclLGRR

6
day3/input Normal file
View File

@ -0,0 +1,6 @@
vJrwpWtwJgWrhcsFMMfFFhFp
jqHRNqRjqzjGDLGLrsFMfFZSrLrFZsSL
PmmdzqPrVvPwwTWBwg
wMqvLMZHhHMvwLHjbvcjnnSBnvTQFn
ttgJtRGJQctTZtZT
CrZsJsPPZsGzwwsLwLmpwMDw

5
day3/package.json Normal file
View File

@ -0,0 +1,5 @@
{
"devDependencies": {
"@types/node": "^18.11.10"
}
}

73
day3/solution.ts Normal file
View File

@ -0,0 +1,73 @@
import { readFileSync } from 'fs';
import { join } from 'path';
function findNDupes(inputArrays): string {
var countMap = {};
for (const inputArray of inputArrays) {
const s = new Set<string>(inputArray);
s.forEach(function(val){
if (val in countMap) {
countMap[val] += 1;
} else {
countMap[val] = 1;
}
});
}
for (const key in countMap) {
if (countMap[key] == inputArrays.length) {
return key;
}
}
}
const fileString = readFileSync(join(__dirname, "inp"), 'utf-8');
const rucksacks = fileString.split("\n");
var sum: number = 0;
for (const rucksack of rucksacks) {
if (rucksack.length == 0) {
continue;
}
const items = rucksack.split('');
const firstHalf = items.slice(0, items.length/2);
const secondHalf = items.slice(items.length/2, items.length);
const ndup = findNDupes([firstHalf, secondHalf])
const s = new Set<string>(ndup);
s.forEach(function(val){
const charNum = val.charCodeAt(0);
if (charNum > 96) {
sum += charNum - 96;
} else {
sum += charNum - 38;
}
});
}
console.log(sum);
sum = 0;
for (var i = 0; i < rucksacks.length; i += 3) {
if (i + 1 >= rucksacks.length) {
continue;
}
const r1 = rucksacks[i].split('');
const r2 = rucksacks[i+1].split('');
const r3 = rucksacks[i+2].split('');
const ndup = findNDupes([r1, r2, r3])
const s = new Set<string>(ndup);
s.forEach(function(val){
const charNum = val.charCodeAt(0);
if (charNum > 96) {
sum += charNum - 96;
} else {
sum += charNum - 38;
}
});
}
console.log(sum);

7
day3/tsconfig.json Normal file
View File

@ -0,0 +1,7 @@
{
"compilerOptions": {
"types": [
"node"
]
}
}