Collect Your Second Star
00:00
So now we kind of changed our code that worked very nicely here, but was hard to scale up to something that we can scale up just by changing this 4
to a 14
.
00:13
Let’s try to run it for 14
and we see that we get the right answer, 19
, and we can go back to the web page and see that, okay, this example should have the answer 19
for part two.
00:27
Okay, that’s very promising. Yes, it looks very promising. We can also check, this was the second example that we included. So that should have the answer 29
.
00:36 So let’s look for that one.
00:40 So I’ll activate this line instead
00:45
and let’s see where we end up. 29
. Yes. So now let’s then look for the full answer.
00:54 This is something that I’ll just point out before we do this. There is no new input for part two. So part two always uses the same input as part one, and you can kind of see a note down here that says, although it hasn’t changed, you can still get your puzzle input.
01:11 So that’s the thing that’s always true for these puzzles, that the two parts we mentioned that they were related, and one way they are related is that they always use the same input.
01:21
So let’s check what would be our final answer for part two. Seems to be 2315
. So it’s a good idea that you remove the print()
call in the for
loop because otherwise you would’ve a big output there.
01:37 Exactly. So let’s try to submit this, and it says that that is also the right answer. So we’re one. Okay. Gold star closer still! We got our second star.
Become a Member to join the conversation.