You are reading a single comment by @Greenbank and its replies. Click here to read the full conversation.
  • 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).

  • Now i've just read up on that algorithm and want to attempt it. Should really just do some work though

  • 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.

About

Avatar for Greenbank @Greenbank started