Тёмный
William Y. Feng
William Y. Feng
William Y. Feng
Подписаться

Day 17: Clumsy Crucible | Advent of Code 2023
7:52
9 месяцев назад
Day 15: Lens Library | Advent of Code 2023
11:44
10 месяцев назад
Day 13: Point of Incidence | Advent of Code 2023
11:39
10 месяцев назад
Day 12: Hot Springs | Advent of Code 2023
17:51
10 месяцев назад
Day 11: Cosmic Expansion | Advent of Code 2023
5:10
10 месяцев назад
Day 10: Pipe Maze | Advent of Code 2023
12:16
10 месяцев назад
Day 9: Mirage Maintenance | Advent of Code 2023
8:04
10 месяцев назад
Day 8: Haunted Wasteland | Advent of Code 2023
11:17
10 месяцев назад
Day 7: Camel Cards | Advent of Code 2023
10:58
10 месяцев назад
Day 4: Scratchcards | Advent of Code 2023
9:23
10 месяцев назад
Day 3: Gear Ratios | Advent of Code 2023
11:24
10 месяцев назад
Day 2: Cube Conundrum | Advent of Code 2023
8:47
10 месяцев назад
Комментарии
@tempdeltavalue
@tempdeltavalue 3 дня назад
03:09 it's not exactly true because you can remove similar pairs like "1 - 2" and "2 - 1" so you will get O(n^2 / 2)
@mateusvmv
@mateusvmv 2 дня назад
Big O ignores constants like the division by two, but yeah that's an optimization in fact, big O is too stupid sometimes: if your algorithm had a fixed amount of particles and kept all of them somewhere very far away until you chose to spawn them, but ran the quadratic algorithm to calculate the gravity, then it would be O(1) because the running time would be constant (as in, constantly the worst lol)
@pawelokowidza
@pawelokowidza 12 дней назад
15:58 ♫
@LakieshaKuzyk-h7l
@LakieshaKuzyk-h7l 14 дней назад
Damon Landing
@photonicsauce7729
@photonicsauce7729 16 дней назад
Hi just have a question. Since n-body problems (for n > 2) are known to be chaotic, isnt the barnes hut algorithm unsuitable for long time scales? The error accumulation may be significant right?
@pnachtwey
@pnachtwey Месяц назад
Use Storm's theorem.
@kaiyueguo1624
@kaiyueguo1624 2 месяца назад
Really good illustration, appreciate a lot❤❤❤
@Niashi24
@Niashi24 2 месяца назад
Good solution but it annoys me greatly when advent of code makes it so that the only way to solve the problem is to look at your specific input data for patterns and make assumptions that weren't in the instructions or the example. Going back to the previous years and this seems to be the only one in 2021 that does (unless day 25 has it, haven't gotten to it yet) but 2023 had like 5 of these. Is it really that hard to just...make the assumptions part of the problem?
@suryanshsingh7247
@suryanshsingh7247 2 месяца назад
thats was amazing
@askforinfo
@askforinfo 2 месяца назад
Which software you has been used for this presentation?
@BrillCodeCS
@BrillCodeCS 2 месяца назад
This is the best explanation of Miller-Rabin Test I've seen so far. Thanks for this.
@andreaslundin192
@andreaslundin192 2 месяца назад
This is an interesting solution for problem 4, but I am still trying to fully understand it. I can see how the location of a specific cut fully determines a set of subsets, and the number of steps we get for this given cut. However, I struggle to convince myself why one of the optimal solutions must exist among those provided by the cuts.
@Rozy754-i8g
@Rozy754-i8g 2 месяца назад
could you please provide the codes here?
@sloodey8315
@sloodey8315 3 месяца назад
thanks
@coopergates9680
@coopergates9680 4 месяца назад
My recommendation for dealing with cases where the base and test number are not relatively prime is to only remove all factors of the test number from the base if the base is indeed a multiple of the test number. If the test number is prime but is not relatively prime to the base, then the test number must divide the base, and removing all factors of it will yield a "new" base that is indeed relatively prime to the test number, so the Miller-Rabin test can still run (if the resulting "new" base is all the way down to 1, pass the test number for that base right away). This guarantees that if a composite test number does not divide the base and the test number and base are not relatively prime, the test will properly flag the test number as composite, while still allowing primes that divide an original base to pass the test.
@integrantedavidanoturna
@integrantedavidanoturna 4 месяца назад
The explanation was good enough until you brough the tortoise and the hare. Then I had to sub.
@potzko2552
@potzko2552 4 месяца назад
I "invented" this when I was in eleventh grade learning how to program, it was my first real "hard" problem I solved kinda neat seeing someone else talk about it :)
@WilliamYFeng
@WilliamYFeng 2 месяца назад
yo that's so cool :D looking back on this now I realize how many steps this actually involves, so kudos to you!
@TarkTheConlanger
@TarkTheConlanger 5 месяцев назад
I feel really stupid for still not understanding how this works
@tanhnguyen2025
@tanhnguyen2025 5 месяцев назад
very easy to understand.
@metallust
@metallust 5 месяцев назад
why lcm??
@zweitekonto9654
@zweitekonto9654 5 месяцев назад
Doesn't part2 takes like a second to run with just looping over all the edge points like this?
@dreawmy2912
@dreawmy2912 6 месяцев назад
coding in word...
@aaronmorgan4466
@aaronmorgan4466 6 месяцев назад
Dijkstra's algorithm, ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-EFg3u_E6eHU.html.
@wansichen3743
@wansichen3743 6 месяцев назад
the age of the universe is 13.8 billion years ago
@ricksgarage-jf8pv
@ricksgarage-jf8pv 7 месяцев назад
Great summary of the Pi algorithms!
@leducphuclong
@leducphuclong 7 месяцев назад
Please continue, I will follow constantly!!
@leducphuclong
@leducphuclong 7 месяцев назад
How a good exp !!
@b0nes95
@b0nes95 8 месяцев назад
I am trying to learn dynamic programming, and for the most basic of problems like the staircase stepping I fully understand how to reach those objectie function/recurrence relationships. I had no idea how to apply DP to this problem and I thank you for taking the time to exlain it it in a table manner (non-recursive) because it truly captures the essence of dynamic programming that way, it feels like to me at least.
@Minji00001
@Minji00001 8 месяцев назад
In this year i'll go😊😊
@akoshhh_3226
@akoshhh_3226 6 месяцев назад
how did u know that u were accepted ? have u already sent responses to ur applications?
@aaditya4998
@aaditya4998 8 месяцев назад
Just add this line before the part one if else statements #also i used value instead of amount if len(value) != 0 : value[-1] += joker else: value = [joker]
@0MVR_0
@0MVR_0 8 месяцев назад
this idea is coherent as a lagrange point
@kaleoxy
@kaleoxy 8 месяцев назад
Congrats on plat!
@filmamundo9194
@filmamundo9194 8 месяцев назад
wtf, i was trying to do systems of equations with conservation of energy when it was this easy
@CursedOneShot
@CursedOneShot 9 месяцев назад
Really Amazing video :D
@TheFrogfather1
@TheFrogfather1 9 месяцев назад
Welcome back! I bailed around day 10 but am still interested in seeing the solutions for later puzzles.
@aspuzling
@aspuzling 9 месяцев назад
Thank you for reminding me to rewatch the RU-vid classic Amateur by Lasse Gjertsen and for putting a different spin on it.
@footybite-gt1by
@footybite-gt1by 9 месяцев назад
12.2 has been kicking my ass for 2 weeks now, I understand the purpose of pushing solutions to a map to reduce the amount of time spent processing solutions. People have tried to explain using a fib() function, which makes sense. Instinct tells me I should be running the original 12.1 to get solutions for each individual block, then multiplying out for the five. What throws me is how the combination works, there's an extra ? in the middle so the original solutions only make sense if every additional ? is a . I'm trying to understand dynamic programming and I keep getting "it's complicated, I won't go into it" 😂 I'm sat there like no, please do!
@HoSza1
@HoSza1 9 месяцев назад
ok, now let's do 2048 bits 😂
@AlfredZhong
@AlfredZhong 9 месяцев назад
Really solved my problem. I had no idea about the part2 as I have never heard of the Ray Casting Algorithm. 😂Thank you.
@lee-uq6pm
@lee-uq6pm 9 месяцев назад
i still didnt understand how do you know to append in which box? i dont get the logic
@vegeta3993
@vegeta3993 9 месяцев назад
I implemented the "hashmap" as a list of dictionaries (python3). The list is 256 elements long, and the index of the list to either place the lens into or pop from is the result of the hashing algorithm developed in part 1 on the first letters in the current line in the sequence (ie. 'rn', 'cm', 'qp', ...). Hope that helps.
@krige
@krige 9 месяцев назад
Thank you for the explanation of part 2, that was very clear. Would be interesting to know what made you think to look into the input data and how you came up to the conclusion that the nodes looped. I tried to solve it by spawning a thread for each starting node and then let them run until they all reach a node ending with 'Z': this will be super fast, I thought, but instead it took forever. It never occurred to me to look into possible patterns in the input data. I am kind of disappointed about the fact they did not give any hint about the input pattern.
@Irakli008
@Irakli008 9 месяцев назад
I reached the same conclusion that William did, but only after trying to do parallel runs for all of them, like you. When I tried to debug it, I took a single starting point and made it loop 10 times and logged the amount of steps per loop. I noticed that the 10th loop was 10x bigger than the 1st loop, and everything in between was also a multiple.
@Telepriester
@Telepriester 9 месяцев назад
I like your videos a lot. thanks for sharing.👍
@agnesakne4409
@agnesakne4409 9 месяцев назад
Your explanation is not superb
@DingoDummy2026
@DingoDummy2026 10 месяцев назад
I wish I saw this before taking number theory, would have helped so much 🥲
@agnesakne4409
@agnesakne4409 10 месяцев назад
when will you get married
@leifmessinger
@leifmessinger 9 месяцев назад
Hi mom
@TheTrienco
@TheTrienco 10 месяцев назад
Kept coming back to this one. From brute force (2.5min), to multithreaded (45s), to parallel reverse lookup (75ms) and finally splitting the ranges from back to front (450us). Amazing how much difference an approach can make
@briandawley7808
@briandawley7808 9 месяцев назад
For reverse lookup do you mean start with locations? I couldn't figure out how to handle when something "upstream" doesn't have a mapped downstream value so instead just uses itself in that case.
@TheTrienco
@TheTrienco 9 месяцев назад
@@briandawley7808 yes. But you have to pretty much start at 0 and count up, because the default mapping says "if no mapping, value maps to itself". So you can't just look at the location ranges, since all values are potentially possible.
@briandawley7808
@briandawley7808 9 месяцев назад
@TheTrienco yeah I tried going from zero but the "use self if unmapped" rule tripped me up.
@TeemuSa
@TeemuSa 10 месяцев назад
In part 2, Instead of trying every substitution, I iterated over rows, and kept a tally of the total number of differing characters. If that exceeded 1, I had an early stop, and if it wasn't 1 in the end the line wasn't a smudged mirror location.
@TheTrienco
@TheTrienco 10 месяцев назад
For part 1 I was happy with my one pass approach. Making it more generic for part 2 somewhat ruined the neatness. Rolling a column north just keeps track of the next valid destination as it goes, so no nested loops needed (swapping ranges with indexing for clarity): int64_t dst_row = 0; for (row...) { if (grid[row][col] == 'O') { swap(grid[dst_row++][col], grid[row][col]); } else if (grid[row][col] == '#') { dst_row = row + 1; } } Still can't get part under 19ms, though. All the copies to keep a history up to the first cycle must be killing it.
@TheFrogfather1
@TheFrogfather1 10 месяцев назад
In part one we have a method that finds a reflection point (horizontal or vertical) where there are 0 errors between reflected lines. So for part two we can run the same method but looking for exactly one error instead of 0! I tried this thinking I was probably missing something and was quite surprised when it worked!
@seboqw7099
@seboqw7099 10 месяцев назад
In part 2 there is no need to count the rem_jokers variable and also add it in if condition because it will always be 0. Remove it, think about it and see that the result will be the same.
@LeandroCoutinho
@LeandroCoutinho 10 месяцев назад
Nice! In the second grid in the sample, it changes the fifth symbol in row 2, but why couldn't it be the fifth in row 1 to a dot, please? #...##..# #....#..#