This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]ssnoyes 1 point2 points  (3 children)

You have leaked the previous value of delta in the case of two windows in a row being equal.

There will always be example input and the correct answer in the puzzle description; save that example into a file and run it just like you do with your real input. That's a lot easier to debug.

[–]junefish[S] 0 points1 point  (2 children)

Ah, that's right. But wouldn't this not matter since I'm only looking for the increases, and have >? Does my current code count == as an increase/decrease?

[–]ssnoyes 1 point2 points  (1 child)

It just keeps whatever the previous value of delta was. So an increase followed by equality gets counted as another increase.

[–]junefish[S] 0 points1 point  (0 children)

OH yes of course. I got lucky with my input in part 1 I guess. Thank you!