Day 3: Gear Ratios | Advent of Code 2023

  Рет қаралды 5,940

William Y. Feng

William Y. Feng

Күн бұрын

Пікірлер: 11
@colehdlr
@colehdlr 10 ай бұрын
My method focused on finding then looking around each symbol, then adding the numbers around to a global sum (of course storing their start points in an array so we don't get the same one twice). It may have been worse, but I was very happy with the part 2 lol
@kozmicluis2552
@kozmicluis2552 10 ай бұрын
With any language that has a group-by function part 2 becomes easy as hell. All I had to do was for each number basically save the number itself along with the location of its adjacent gear (after observing that every number only had 1 or no symbol adjacent to it) if it exists. Then group by this location into a map/hashmap, get the values, filter the ones where the amount of numbers is exactly 2, then multiply both numbers on each gear, add them up, profit.
@blaise9614
@blaise9614 10 ай бұрын
Great presentation. Thank you for being concise and clear with your structure.
@NicolastheThird-h6m
@NicolastheThird-h6m 10 ай бұрын
Great solution. I made some complicated bs, this is so much better and easier to read.
@dylansuther
@dylansuther 10 ай бұрын
This is such a smart solution. Thank you!
@willzin-da-esfiha
@willzin-da-esfiha 10 ай бұрын
I've created a point struct to store position of a character. Then, I stored the number, the positions of its start and end characters. Then I pushed the info into an array. I stored the position of the symbols also. Then did some coordinates calc to check if the numbers are in range of the symbol. The part 2 was easy since I just changed the code to store only asterisk symbols and check the length of near numbers. But I was thinking... It's still slow. I will use an array of buckets to improve near point search, checking only 3 lines for each symbol.
@willzin-da-esfiha
@willzin-da-esfiha 10 ай бұрын
Update: the buckets' version work almost instantaneously
@DiegoCattaneo
@DiegoCattaneo 10 ай бұрын
I came out with a very similar code.. but mine isn't working 😂. I'll try your code with my input. Thanks
@bigupbig2198
@bigupbig2198 10 ай бұрын
I feel so dumb I did day 1,2 but had no idea how to do this day. Had to cheat and look up the answer
@NicolastheThird-h6m
@NicolastheThird-h6m 10 ай бұрын
No problem we are here to learn. This isn't cheating as long as you get what he is doing
@TheFrogfather1
@TheFrogfather1 10 ай бұрын
I made a total mess of part two to the point where 'git reset --hard' was the best option. Got there eventually but not an elegant solution at all. The feeling amongst work colleagues is that the puzzles seem a bit harder this year. Let's see how it goes...
Day 5: If You Give A Seed A Fertilizer | Advent of Code 2023
13:16
William Y. Feng
Рет қаралды 6 М.
How I animate 3Blue1Brown | A Manim demo with Ben Sparks
53:41
3Blue1Brown
Рет қаралды 738 М.
How it feels when u walk through first class
00:52
Adam W
Рет қаралды 24 МЛН
Миллионер | 2 - серия
16:04
Million Show
Рет қаралды 1,6 МЛН
Day 12: Hot Springs | Advent of Code 2023
17:51
William Y. Feng
Рет қаралды 3,9 М.
Day 10: Pipe Maze | Advent of Code 2023
12:16
William Y. Feng
Рет қаралды 4,4 М.
Winning Google Kickstart Round A 2020 + Facecam
17:10
William Lin (tmwilliamlin168)
Рет қаралды 9 МЛН
Day 8: Haunted Wasteland | Advent of Code 2023
11:17
William Y. Feng
Рет қаралды 1,8 М.
Being Competent With Coding Is More Fun
11:13
TheVimeagen
Рет қаралды 98 М.
Advent of Code 2023 Day 20: Pulse Propagation
25:49
HyperNeutrino
Рет қаралды 4,1 М.
Day 7: Camel Cards | Advent of Code 2023
10:58
William Y. Feng
Рет қаралды 1,2 М.
Just enough assembly to blow your mind
29:31
Kay Lack
Рет қаралды 106 М.
Day 04 - Advent of Code
29:58
chris biscardi
Рет қаралды 4,4 М.
going fast is about doing less
19:41
leddoo
Рет қаралды 173 М.
How it feels when u walk through first class
00:52
Adam W
Рет қаралды 24 МЛН