mirror of
https://github.com/seigler/aoc2024
synced 2025-07-26 00:36:10 +00:00
day 1
This commit is contained in:
commit
d54c4c67a2
14 changed files with 2376 additions and 0 deletions
357
.aocrunner.json
Normal file
357
.aocrunner.json
Normal file
|
@ -0,0 +1,357 @@
|
||||||
|
{
|
||||||
|
"version": 1,
|
||||||
|
"year": 2024,
|
||||||
|
"language": "ts",
|
||||||
|
"days": [
|
||||||
|
{
|
||||||
|
"part1": {
|
||||||
|
"solved": true,
|
||||||
|
"result": "2113135",
|
||||||
|
"attempts": [],
|
||||||
|
"time": 1.29285
|
||||||
|
},
|
||||||
|
"part2": {
|
||||||
|
"solved": true,
|
||||||
|
"result": "19097157",
|
||||||
|
"attempts": [],
|
||||||
|
"time": 1.050866
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"part1": {
|
||||||
|
"solved": false,
|
||||||
|
"result": null,
|
||||||
|
"attempts": [],
|
||||||
|
"time": null
|
||||||
|
},
|
||||||
|
"part2": {
|
||||||
|
"solved": false,
|
||||||
|
"result": null,
|
||||||
|
"attempts": [],
|
||||||
|
"time": null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"part1": {
|
||||||
|
"solved": false,
|
||||||
|
"result": null,
|
||||||
|
"attempts": [],
|
||||||
|
"time": null
|
||||||
|
},
|
||||||
|
"part2": {
|
||||||
|
"solved": false,
|
||||||
|
"result": null,
|
||||||
|
"attempts": [],
|
||||||
|
"time": null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"part1": {
|
||||||
|
"solved": false,
|
||||||
|
"result": null,
|
||||||
|
"attempts": [],
|
||||||
|
"time": null
|
||||||
|
},
|
||||||
|
"part2": {
|
||||||
|
"solved": false,
|
||||||
|
"result": null,
|
||||||
|
"attempts": [],
|
||||||
|
"time": null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"part1": {
|
||||||
|
"solved": false,
|
||||||
|
"result": null,
|
||||||
|
"attempts": [],
|
||||||
|
"time": null
|
||||||
|
},
|
||||||
|
"part2": {
|
||||||
|
"solved": false,
|
||||||
|
"result": null,
|
||||||
|
"attempts": [],
|
||||||
|
"time": null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"part1": {
|
||||||
|
"solved": false,
|
||||||
|
"result": null,
|
||||||
|
"attempts": [],
|
||||||
|
"time": null
|
||||||
|
},
|
||||||
|
"part2": {
|
||||||
|
"solved": false,
|
||||||
|
"result": null,
|
||||||
|
"attempts": [],
|
||||||
|
"time": null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"part1": {
|
||||||
|
"solved": false,
|
||||||
|
"result": null,
|
||||||
|
"attempts": [],
|
||||||
|
"time": null
|
||||||
|
},
|
||||||
|
"part2": {
|
||||||
|
"solved": false,
|
||||||
|
"result": null,
|
||||||
|
"attempts": [],
|
||||||
|
"time": null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"part1": {
|
||||||
|
"solved": false,
|
||||||
|
"result": null,
|
||||||
|
"attempts": [],
|
||||||
|
"time": null
|
||||||
|
},
|
||||||
|
"part2": {
|
||||||
|
"solved": false,
|
||||||
|
"result": null,
|
||||||
|
"attempts": [],
|
||||||
|
"time": null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"part1": {
|
||||||
|
"solved": false,
|
||||||
|
"result": null,
|
||||||
|
"attempts": [],
|
||||||
|
"time": null
|
||||||
|
},
|
||||||
|
"part2": {
|
||||||
|
"solved": false,
|
||||||
|
"result": null,
|
||||||
|
"attempts": [],
|
||||||
|
"time": null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"part1": {
|
||||||
|
"solved": false,
|
||||||
|
"result": null,
|
||||||
|
"attempts": [],
|
||||||
|
"time": null
|
||||||
|
},
|
||||||
|
"part2": {
|
||||||
|
"solved": false,
|
||||||
|
"result": null,
|
||||||
|
"attempts": [],
|
||||||
|
"time": null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"part1": {
|
||||||
|
"solved": false,
|
||||||
|
"result": null,
|
||||||
|
"attempts": [],
|
||||||
|
"time": null
|
||||||
|
},
|
||||||
|
"part2": {
|
||||||
|
"solved": false,
|
||||||
|
"result": null,
|
||||||
|
"attempts": [],
|
||||||
|
"time": null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"part1": {
|
||||||
|
"solved": false,
|
||||||
|
"result": null,
|
||||||
|
"attempts": [],
|
||||||
|
"time": null
|
||||||
|
},
|
||||||
|
"part2": {
|
||||||
|
"solved": false,
|
||||||
|
"result": null,
|
||||||
|
"attempts": [],
|
||||||
|
"time": null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"part1": {
|
||||||
|
"solved": false,
|
||||||
|
"result": null,
|
||||||
|
"attempts": [],
|
||||||
|
"time": null
|
||||||
|
},
|
||||||
|
"part2": {
|
||||||
|
"solved": false,
|
||||||
|
"result": null,
|
||||||
|
"attempts": [],
|
||||||
|
"time": null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"part1": {
|
||||||
|
"solved": false,
|
||||||
|
"result": null,
|
||||||
|
"attempts": [],
|
||||||
|
"time": null
|
||||||
|
},
|
||||||
|
"part2": {
|
||||||
|
"solved": false,
|
||||||
|
"result": null,
|
||||||
|
"attempts": [],
|
||||||
|
"time": null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"part1": {
|
||||||
|
"solved": false,
|
||||||
|
"result": null,
|
||||||
|
"attempts": [],
|
||||||
|
"time": null
|
||||||
|
},
|
||||||
|
"part2": {
|
||||||
|
"solved": false,
|
||||||
|
"result": null,
|
||||||
|
"attempts": [],
|
||||||
|
"time": null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"part1": {
|
||||||
|
"solved": false,
|
||||||
|
"result": null,
|
||||||
|
"attempts": [],
|
||||||
|
"time": null
|
||||||
|
},
|
||||||
|
"part2": {
|
||||||
|
"solved": false,
|
||||||
|
"result": null,
|
||||||
|
"attempts": [],
|
||||||
|
"time": null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"part1": {
|
||||||
|
"solved": false,
|
||||||
|
"result": null,
|
||||||
|
"attempts": [],
|
||||||
|
"time": null
|
||||||
|
},
|
||||||
|
"part2": {
|
||||||
|
"solved": false,
|
||||||
|
"result": null,
|
||||||
|
"attempts": [],
|
||||||
|
"time": null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"part1": {
|
||||||
|
"solved": false,
|
||||||
|
"result": null,
|
||||||
|
"attempts": [],
|
||||||
|
"time": null
|
||||||
|
},
|
||||||
|
"part2": {
|
||||||
|
"solved": false,
|
||||||
|
"result": null,
|
||||||
|
"attempts": [],
|
||||||
|
"time": null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"part1": {
|
||||||
|
"solved": false,
|
||||||
|
"result": null,
|
||||||
|
"attempts": [],
|
||||||
|
"time": null
|
||||||
|
},
|
||||||
|
"part2": {
|
||||||
|
"solved": false,
|
||||||
|
"result": null,
|
||||||
|
"attempts": [],
|
||||||
|
"time": null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"part1": {
|
||||||
|
"solved": false,
|
||||||
|
"result": null,
|
||||||
|
"attempts": [],
|
||||||
|
"time": null
|
||||||
|
},
|
||||||
|
"part2": {
|
||||||
|
"solved": false,
|
||||||
|
"result": null,
|
||||||
|
"attempts": [],
|
||||||
|
"time": null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"part1": {
|
||||||
|
"solved": false,
|
||||||
|
"result": null,
|
||||||
|
"attempts": [],
|
||||||
|
"time": null
|
||||||
|
},
|
||||||
|
"part2": {
|
||||||
|
"solved": false,
|
||||||
|
"result": null,
|
||||||
|
"attempts": [],
|
||||||
|
"time": null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"part1": {
|
||||||
|
"solved": false,
|
||||||
|
"result": null,
|
||||||
|
"attempts": [],
|
||||||
|
"time": null
|
||||||
|
},
|
||||||
|
"part2": {
|
||||||
|
"solved": false,
|
||||||
|
"result": null,
|
||||||
|
"attempts": [],
|
||||||
|
"time": null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"part1": {
|
||||||
|
"solved": false,
|
||||||
|
"result": null,
|
||||||
|
"attempts": [],
|
||||||
|
"time": null
|
||||||
|
},
|
||||||
|
"part2": {
|
||||||
|
"solved": false,
|
||||||
|
"result": null,
|
||||||
|
"attempts": [],
|
||||||
|
"time": null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"part1": {
|
||||||
|
"solved": false,
|
||||||
|
"result": null,
|
||||||
|
"attempts": [],
|
||||||
|
"time": null
|
||||||
|
},
|
||||||
|
"part2": {
|
||||||
|
"solved": false,
|
||||||
|
"result": null,
|
||||||
|
"attempts": [],
|
||||||
|
"time": null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"part1": {
|
||||||
|
"solved": false,
|
||||||
|
"result": null,
|
||||||
|
"attempts": [],
|
||||||
|
"time": null
|
||||||
|
},
|
||||||
|
"part2": {
|
||||||
|
"solved": false,
|
||||||
|
"result": null,
|
||||||
|
"attempts": [],
|
||||||
|
"time": null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
10
.gitignore
vendored
Normal file
10
.gitignore
vendored
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
node_modules
|
||||||
|
*.temp.*
|
||||||
|
*/**/*.temp.*
|
||||||
|
*/**/input.txt
|
||||||
|
*.log
|
||||||
|
*/**/*.log
|
||||||
|
.idea
|
||||||
|
.vscode
|
||||||
|
.env
|
||||||
|
dist
|
1
.prettierignore
Normal file
1
.prettierignore
Normal file
|
@ -0,0 +1 @@
|
||||||
|
lib
|
11
.prettierrc.json
Normal file
11
.prettierrc.json
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"arrowParens": "always",
|
||||||
|
"bracketSpacing": true,
|
||||||
|
"printWidth": 80,
|
||||||
|
"proseWrap": "preserve",
|
||||||
|
"semi": false,
|
||||||
|
"singleQuote": false,
|
||||||
|
"tabWidth": 2,
|
||||||
|
"useTabs": false,
|
||||||
|
"trailingComma": "all"
|
||||||
|
}
|
254
README.md
Normal file
254
README.md
Normal file
|
@ -0,0 +1,254 @@
|
||||||
|
<!-- Entries between SOLUTIONS and RESULTS tags are auto-generated -->
|
||||||
|
|
||||||
|
[](https://adventofcode.com/2024)
|
||||||
|
[](https://nodejs.org/en/download/)
|
||||||
|

|
||||||
|
[](https://github.com/caderek/aocrunner)
|
||||||
|
|
||||||
|
# 🎄 Advent of Code 2024 🎄
|
||||||
|
|
||||||
|
## Solutions
|
||||||
|
|
||||||
|
<!--SOLUTIONS-->
|
||||||
|
|
||||||
|
[](src/day01)
|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|
|
||||||
|
<!--/SOLUTIONS-->
|
||||||
|
|
||||||
|
_Click a badge to go to the specific day._
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```
|
||||||
|
npm i
|
||||||
|
```
|
||||||
|
|
||||||
|
## Running in dev mode
|
||||||
|
|
||||||
|
```
|
||||||
|
npm start <day>
|
||||||
|
```
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```
|
||||||
|
npm start 1
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Results
|
||||||
|
|
||||||
|
<!--RESULTS-->
|
||||||
|
|
||||||
|
```
|
||||||
|
Day 01
|
||||||
|
Time part 1: 1.264ms
|
||||||
|
Time part 2: 1.025ms
|
||||||
|
Both parts: 2.289ms
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
Day 02
|
||||||
|
Time part 1: -
|
||||||
|
Time part 2: -
|
||||||
|
Both parts: -
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
Day 03
|
||||||
|
Time part 1: -
|
||||||
|
Time part 2: -
|
||||||
|
Both parts: -
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
Day 04
|
||||||
|
Time part 1: -
|
||||||
|
Time part 2: -
|
||||||
|
Both parts: -
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
Day 05
|
||||||
|
Time part 1: -
|
||||||
|
Time part 2: -
|
||||||
|
Both parts: -
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
Day 06
|
||||||
|
Time part 1: -
|
||||||
|
Time part 2: -
|
||||||
|
Both parts: -
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
Day 07
|
||||||
|
Time part 1: -
|
||||||
|
Time part 2: -
|
||||||
|
Both parts: -
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
Day 08
|
||||||
|
Time part 1: -
|
||||||
|
Time part 2: -
|
||||||
|
Both parts: -
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
Day 09
|
||||||
|
Time part 1: -
|
||||||
|
Time part 2: -
|
||||||
|
Both parts: -
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
Day 10
|
||||||
|
Time part 1: -
|
||||||
|
Time part 2: -
|
||||||
|
Both parts: -
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
Day 11
|
||||||
|
Time part 1: -
|
||||||
|
Time part 2: -
|
||||||
|
Both parts: -
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
Day 12
|
||||||
|
Time part 1: -
|
||||||
|
Time part 2: -
|
||||||
|
Both parts: -
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
Day 13
|
||||||
|
Time part 1: -
|
||||||
|
Time part 2: -
|
||||||
|
Both parts: -
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
Day 14
|
||||||
|
Time part 1: -
|
||||||
|
Time part 2: -
|
||||||
|
Both parts: -
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
Day 15
|
||||||
|
Time part 1: -
|
||||||
|
Time part 2: -
|
||||||
|
Both parts: -
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
Day 16
|
||||||
|
Time part 1: -
|
||||||
|
Time part 2: -
|
||||||
|
Both parts: -
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
Day 17
|
||||||
|
Time part 1: -
|
||||||
|
Time part 2: -
|
||||||
|
Both parts: -
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
Day 18
|
||||||
|
Time part 1: -
|
||||||
|
Time part 2: -
|
||||||
|
Both parts: -
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
Day 19
|
||||||
|
Time part 1: -
|
||||||
|
Time part 2: -
|
||||||
|
Both parts: -
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
Day 20
|
||||||
|
Time part 1: -
|
||||||
|
Time part 2: -
|
||||||
|
Both parts: -
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
Day 21
|
||||||
|
Time part 1: -
|
||||||
|
Time part 2: -
|
||||||
|
Both parts: -
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
Day 22
|
||||||
|
Time part 1: -
|
||||||
|
Time part 2: -
|
||||||
|
Both parts: -
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
Day 23
|
||||||
|
Time part 1: -
|
||||||
|
Time part 2: -
|
||||||
|
Both parts: -
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
Day 24
|
||||||
|
Time part 1: -
|
||||||
|
Time part 2: -
|
||||||
|
Both parts: -
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
Day 25
|
||||||
|
Time part 1: -
|
||||||
|
Time part 2: -
|
||||||
|
Both parts: -
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
Total stars: 2/50
|
||||||
|
Total time: 2.289ms
|
||||||
|
```
|
||||||
|
|
||||||
|
<!--/RESULTS-->
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
✨🎄🎁🎄🎅🎄🎁🎄✨
|
1505
package-lock.json
generated
Normal file
1505
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
26
package.json
Normal file
26
package.json
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
{
|
||||||
|
"name": "aoc2024",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "Advent of Code 2024 - solutions",
|
||||||
|
"type": "module",
|
||||||
|
"scripts": {
|
||||||
|
"start": "aocrunner day",
|
||||||
|
"build": "aocrunner build",
|
||||||
|
"format": "prettier -w src",
|
||||||
|
"update:readme": "aocrunner update:readme"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"aoc"
|
||||||
|
],
|
||||||
|
"author": "Joshua Seigler",
|
||||||
|
"license": "ISC",
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/node": "^16.11.6",
|
||||||
|
"aocrunner": "^1.10.0",
|
||||||
|
"prettier": "^2.8.0"
|
||||||
|
},
|
||||||
|
"dependencies": {},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=16.13.0"
|
||||||
|
}
|
||||||
|
}
|
9
src/day01/README.md
Normal file
9
src/day01/README.md
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
# 🎄 Advent of Code 2024 - day 1 🎄
|
||||||
|
|
||||||
|
## Info
|
||||||
|
|
||||||
|
Task description: [link](https://adventofcode.com/2024/day/1)
|
||||||
|
|
||||||
|
## Notes
|
||||||
|
|
||||||
|
...
|
64
src/day01/index.ts
Normal file
64
src/day01/index.ts
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
import run from "aocrunner"
|
||||||
|
|
||||||
|
const parseInput = (rawInput: string) => {
|
||||||
|
const rows = rawInput.split('\n').map(line => line.split(/\s+/).map(Number))
|
||||||
|
let lists: number[][] = [[], []]
|
||||||
|
rows.forEach(row => {
|
||||||
|
row.forEach((value, index) => lists[index].push(value))
|
||||||
|
})
|
||||||
|
return lists
|
||||||
|
}
|
||||||
|
|
||||||
|
const part1 = (rawInput: string) => {
|
||||||
|
const input = parseInput(rawInput)
|
||||||
|
input.forEach(list => list.sort())
|
||||||
|
let total = 0
|
||||||
|
for (let i = 0; i < input[0].length; i++) {
|
||||||
|
total += Math.abs(input[0][i] - input[1][i])
|
||||||
|
}
|
||||||
|
return total
|
||||||
|
}
|
||||||
|
|
||||||
|
const part2 = (rawInput: string) => {
|
||||||
|
const [left, right] = parseInput(rawInput)
|
||||||
|
right.sort()
|
||||||
|
const counts = new Map<number, number>()
|
||||||
|
right.forEach(entry => {
|
||||||
|
counts.set(entry, (counts.get(entry) ?? 0) + 1)
|
||||||
|
})
|
||||||
|
const total = left.reduce((acc, cur) => { return acc + cur * (counts.get(cur) ?? 0)}, 0)
|
||||||
|
return total
|
||||||
|
}
|
||||||
|
|
||||||
|
run({
|
||||||
|
part1: {
|
||||||
|
tests: [
|
||||||
|
{
|
||||||
|
input: `3 4
|
||||||
|
4 3
|
||||||
|
2 5
|
||||||
|
1 3
|
||||||
|
3 9
|
||||||
|
3 3`,
|
||||||
|
expected: 11,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
solution: part1,
|
||||||
|
},
|
||||||
|
part2: {
|
||||||
|
tests: [
|
||||||
|
{
|
||||||
|
input: `3 4
|
||||||
|
4 3
|
||||||
|
2 5
|
||||||
|
1 3
|
||||||
|
3 9
|
||||||
|
3 3`,
|
||||||
|
expected: 31,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
solution: part2,
|
||||||
|
},
|
||||||
|
trimTestInputs: true,
|
||||||
|
onlyTests: false,
|
||||||
|
})
|
9
src/day02/README.md
Normal file
9
src/day02/README.md
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
# 🎄 Advent of Code 2024 - day 2 🎄
|
||||||
|
|
||||||
|
## Info
|
||||||
|
|
||||||
|
Task description: [link](https://adventofcode.com/2024/day/2)
|
||||||
|
|
||||||
|
## Notes
|
||||||
|
|
||||||
|
...
|
38
src/day02/index.ts
Normal file
38
src/day02/index.ts
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
import run from "aocrunner"
|
||||||
|
|
||||||
|
const parseInput = (rawInput: string) => rawInput
|
||||||
|
|
||||||
|
const part1 = (rawInput: string) => {
|
||||||
|
const input = parseInput(rawInput)
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const part2 = (rawInput: string) => {
|
||||||
|
const input = parseInput(rawInput)
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
run({
|
||||||
|
part1: {
|
||||||
|
tests: [
|
||||||
|
// {
|
||||||
|
// input: ``,
|
||||||
|
// expected: "",
|
||||||
|
// },
|
||||||
|
],
|
||||||
|
solution: part1,
|
||||||
|
},
|
||||||
|
part2: {
|
||||||
|
tests: [
|
||||||
|
// {
|
||||||
|
// input: ``,
|
||||||
|
// expected: "",
|
||||||
|
// },
|
||||||
|
],
|
||||||
|
solution: part2,
|
||||||
|
},
|
||||||
|
trimTestInputs: true,
|
||||||
|
onlyTests: false,
|
||||||
|
})
|
38
src/template/index.ts
Normal file
38
src/template/index.ts
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
import run from "aocrunner"
|
||||||
|
|
||||||
|
const parseInput = (rawInput: string) => rawInput
|
||||||
|
|
||||||
|
const part1 = (rawInput: string) => {
|
||||||
|
const input = parseInput(rawInput)
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const part2 = (rawInput: string) => {
|
||||||
|
const input = parseInput(rawInput)
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
run({
|
||||||
|
part1: {
|
||||||
|
tests: [
|
||||||
|
// {
|
||||||
|
// input: ``,
|
||||||
|
// expected: "",
|
||||||
|
// },
|
||||||
|
],
|
||||||
|
solution: part1,
|
||||||
|
},
|
||||||
|
part2: {
|
||||||
|
tests: [
|
||||||
|
// {
|
||||||
|
// input: ``,
|
||||||
|
// expected: "",
|
||||||
|
// },
|
||||||
|
],
|
||||||
|
solution: part2,
|
||||||
|
},
|
||||||
|
trimTestInputs: true,
|
||||||
|
onlyTests: false,
|
||||||
|
})
|
31
src/utils/index.ts
Normal file
31
src/utils/index.ts
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
/**
|
||||||
|
* Root for your util libraries.
|
||||||
|
*
|
||||||
|
* You can import them in the src/template/index.ts,
|
||||||
|
* or in the specific file.
|
||||||
|
*
|
||||||
|
* Note that this repo uses ES Modules, so you have to explicitly specify
|
||||||
|
* .js extension (yes, .js not .ts - even for TypeScript files)
|
||||||
|
* for imports that are not imported from node_modules.
|
||||||
|
*
|
||||||
|
* For example:
|
||||||
|
*
|
||||||
|
* correct:
|
||||||
|
*
|
||||||
|
* import _ from 'lodash'
|
||||||
|
* import myLib from '../utils/myLib.js'
|
||||||
|
* import { myUtil } from '../utils/index.js'
|
||||||
|
*
|
||||||
|
* incorrect:
|
||||||
|
*
|
||||||
|
* import _ from 'lodash'
|
||||||
|
* import myLib from '../utils/myLib.ts'
|
||||||
|
* import { myUtil } from '../utils/index.ts'
|
||||||
|
*
|
||||||
|
* also incorrect:
|
||||||
|
*
|
||||||
|
* import _ from 'lodash'
|
||||||
|
* import myLib from '../utils/myLib'
|
||||||
|
* import { myUtil } from '../utils'
|
||||||
|
*
|
||||||
|
*/
|
23
tsconfig.json
Normal file
23
tsconfig.json
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "es2020",
|
||||||
|
"module": "es2020",
|
||||||
|
"removeComments": true,
|
||||||
|
"declaration": true,
|
||||||
|
"outDir": "./dist",
|
||||||
|
"preserveConstEnums": true,
|
||||||
|
"strict": false,
|
||||||
|
"allowSyntheticDefaultImports": true,
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"importHelpers": true
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"src"
|
||||||
|
],
|
||||||
|
"exclude": [
|
||||||
|
"node_modules",
|
||||||
|
"src/**/*.test.ts",
|
||||||
|
"src/**/*.temp.ts"
|
||||||
|
]
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue