Full description: 2023 Day 1
My solution: day_one.js
Language: JavaScript
What is the sum of all the calibration values in your document, where each value is determined by combining the first digit and the last digit of each line into a two-digit number?
1abc2
--------- 12pqr3stu8vwx
--- 38a1b2c3d4e5f
--- 15treb7uchet
---- 77
Sum: 142
What is the sum of all calibration values in your document, where each value is determined by identifying the real first and last digit (including those spelled out as words) on each line and combining them into a two-digit number?
two1nine
----------- 29eightwothree
------- 83abcone2threexyz
---- 13xtwone3four
-------- 244nineeightseven2
--- 42zoneight234
-------- 147pqrstsixteen
------ 76
Sum: 281
Full description: 2023 Day 2
My solution: day_two.py
Language: Python
Determine which games, from a list where each game shows different sets of colored cubes, would have been possible with a bag containing only
12
red cubes13
green cubes14
blue cubes
For each game, check if any set of cubes shown exceeds these limits. The sum of the IDs of the games that are possible under these conditions is the answer.
- Game 1:
3
blue,4
red;1
red,2
green,6
blue;2
green - Game 2:
1
blue,2
green;3
green,4
blue,1
red;1
green,1
blue - Game 3:
8
green,6
blue,20
red;5
blue,4
red,13
green;5
green,1
red - Game 4:
1
green,3
red,6
blue;3
green,6
red;3
green,15
blue,14
red - Game 5:
6
red,1
blue,3
green;2
blue,1
red,2
green
Possible games: 1
, 2
, 5
Sum of possible game IDs: 8
For each game, determine the minimum number of red, green, and blue cubes that could have been in the bag to make the game possible.
Calculate the power
of each game's minimum set of cubes by multiplying the numbers of red, green, and blue cubes together. The final answer is the sum of these powers for all the games.
Using the same games as above, the minimum sets of cubes for each game are:
- Game 1:
4
red,2
green,6
blue - Game 2:
1
red,3
green,4
blue - Game 3:
20
red,13
green,6
blue - Game 4:
14
red,3
green,15
blue - Game 5:
6
red,3
green,2
blue
Power of
- Game 1:
48
- Game 2:
12
- Game 3:
1560
- Game 4:
630
- Game 5:
36
Sum of powers: 2286
Full description: 2023 Day 3
My solution: day_three.py
Language: Python
Calculate the sum of all "part numbers" in an engine schematic, where a part number is defined as any number adjacent (including diagonally) to a symbol. Periods (.) do not count as symbols.
467..114..
...*......
..35..633.
......#...
617*......
.....+.58.
..592.....
......755.
...$.*....
.664.598..
Numbers not adjacent to symbols: 114, 58
Sum of adjacent numbers or "part numbers": 467 + 35 + 633 + 617 + 592 + 755 + 664 + 598 = 4381
Find the gear ratio of every gear in the engine schematic and add them up. A gear is any * symbol that is adjacent to exactly two part numbers. The gear ratio is calculated by multiplying these two part numbers together. In the provided example, there are two gears with gear ratios of 16345 and 451490, respectively. The final answer is the sum of all gear ratios in the schematic.
Using the same schematic as above, the gear ratios are: 16345, 451490
Sum of gear ratios: 467835