Senior Software Engineer vs. Advent of Code Day 4 | VOD

Поділитися
Вставка
  • Опубліковано 6 лют 2025

КОМЕНТАРІ • 3

  • @paulnikonowicz
    @paulnikonowicz Місяць тому +1

    I think both algos can be reduced to an O(N) runtime so it's probably safe to assume this is the best you can do here.

    • @artemis_134
      @artemis_134  Місяць тому

      It feels like something that has a snazzy mathy solution I'm just not aware of, but I might be overthinking it 🤷‍♀️

    • @paulnikonowicz
      @paulnikonowicz Місяць тому +1

      @@artemis_134 a snazzy mathy solution may exist, that could be true. but given the format of the data, you'll have to read all the items at least once; which is what you're doing. and if you were to attempt to put the data into a better format, you'd still have to read everything; which still would be O(N). so although you may be able to certainly speed up the runtime performance, the algorithmic runtime complexity remains linear.