You are reading a single comment by @Greenbank and its replies. Click here to read the full conversation.
  • I kept track of the instances of each character in a map. Added the next char and removed the one n back. Uniqueness testing was simply asking the map how many entries it had in it, if it was n then job done.

    Of course, I did manage to fail to pick up on the case where the first n chars in the string are unique, but that's unlikely to be the puzzle input, but it's fixed now.

    I don't really worry about optimising the early puzzles too much, all so far run in under 0.002s so I'm still on track to keep within my 1s budget.

About

Avatar for Greenbank @Greenbank started