Updated readme for day 3
This commit is contained in:
parent
2563a66d9c
commit
170d7b5647
14
README.md
14
README.md
|
@ -12,3 +12,17 @@ For the second part, one now had to, instead of considering the next digit in th
|
||||||
For the second challenge, part one, the objective was to look through a bunch of lists, find the maximum and minimum value and then subtract these for each list. In the end, the results of the different subtractions had to be summed up and this would be the result.
|
For the second challenge, part one, the objective was to look through a bunch of lists, find the maximum and minimum value and then subtract these for each list. In the end, the results of the different subtractions had to be summed up and this would be the result.
|
||||||
|
|
||||||
For the second part, the calculation of the checksum had changed to now being calculated from finding the only pair of evenly divisible numbers from each list and then sum up the results of the divisions.
|
For the second part, the calculation of the checksum had changed to now being calculated from finding the only pair of evenly divisible numbers from each list and then sum up the results of the divisions.
|
||||||
|
|
||||||
|
## The 3rd of December
|
||||||
|
The goal was to look at a spiral which followed this pattern:
|
||||||
|
|
||||||
|
![](https://dcav.pw/amdqTaZu)
|
||||||
|
|
||||||
|
and then figure out what the `manhattan distance` is from the input number to the center. I noticed a pattern in the bottom left corner, $`9, 25, 49, ...`$ and then saw that the squareroot of that number concidentally was the length of the side as well. Because of this, I could find the closests number to my input, where the squareroot of that number followed that pattern, $`3,5,7`$. After I knew what the side length was, I could figure out where my input number was, relative to that and from there I could find the actual distance to the center.
|
||||||
|
|
||||||
|
|
||||||
|
For the second part, the spiral had changed slightly. Now every number was the sum of all surrounding numbers, so the spiral would look like this:
|
||||||
|
|
||||||
|
![](https://dcav.pw/amoeFOuI)
|
||||||
|
|
||||||
|
I was not able to find a particular pattern in this, so I ended up building the spiral, using the fact that Ruby allows for hashes to have a default value, so I could set that to 0 and then iniate (0,0) => 1 and from there count the the numbers around it. The implementation is somewhat ugly.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user