Search results
Your code is too long to be posted here directly, so instead of wasting your time fixing the formatting, read our article on oversized code which contains two possible solutions. Please edit your post to put your code in an external link and link that here instead. Reply. OsipXD.
4 gru 2022 · For the first problem of day 4, we are given two pairs of numbers on each line. They are essentially ranges, and we must work out if one range fits in another range. Here’s some sample data:
12 gru 2022 · Day 4 Puzzle. On day 4 of Advent of Code, we had to find overlapping ranges in pairs of cleaning assignments to prevent the elves from doing the same task twice. For that we get pairs of ranges such as this (with both ends included in the range): 2-4,6-8 2-3,4-5 5-7,7-9 2-8,3-7 6-6,4-6 2-6,4-8. As always, I read in all lines:
Day 15. Part 1: Let $s = (s_0, s_1)$ and $b = (b_0, b_1)$ be the coordinates of a given sensor and its closest beacon. The distance between them is $d = \textup {abs} (s_0 - b_0) + \textup {abs} (s_1 - b1)$. For a given $y$, a point $ (x, y)$ is closer to $s$ than $b$ if $\textup {abs} (x - s_0) < d - abs (y - s_1)$.
1 gru 2022 · Advent of Code 2022 – Day 4 Solution. For day 4, I implemented the class SectionAssignment. It stores the start and end point of a section and provides methods to check if one section fully contains another or if two sections partially overlap:
1 gru 2022 · Day 5 – Puzzle 2. The only modification for this puzzle is how we move the crates. Previously they were moved one by one, now all of the crates are moved at once. So, the only change that needs to be made to the code is how the command is executed.
1 gru 2022 · In some challenges, trying to brute force a solution will take an exponentially long time to calculate. Therefore, it forces you to think about the O (n) complexity of your code and look for more efficient algorithms to solve the challenge in a reasonable timeframe.