You are reading a single comment by @Greenbank and its replies.
Click here to read the full conversation.
-
Day 9 part 2 induced the usual paranoia that the O(n) sliding window algorithm doesn't work (it does as long as you don't have any negative numbers).
You can handle negatives with an extra pass over the array to shift everything to be positive and adjust your target appropriately based on the length of your current window.
Jolly good.
Finally redid today's properly (rather than the hack to just get the answers).
Day 9 part 2 induced the usual paranoia that the O(n) sliding window algorithm doesn't work (it does as long as you don't have any negative numbers).