Day 4: Scratchcards | Advent of Code 2023

Поділитися
Вставка
  • Опубліковано 11 жов 2024

КОМЕНТАРІ • 3

  • @TheFrogfather1
    @TheFrogfather1 10 місяців тому +2

    Interesting approach starting at the end. I took the view that a given card will never change cards above it so it made more sense (to me anyway) to start at the top. No matter, it's always interesting to see other folk's solutions!

  • @chillidog8726
    @chillidog8726 10 місяців тому +1

    i never get how people come up with these super short awnsers.
    i just created sets for each card and took the intersection as my solutuion to part one.
    for part two i walked the list of all cars down and if i found a card was winning i would add that amount to the next cards well times the current card amount and then i just sum all of them up.

    • @RoelAdriaans
      @RoelAdriaans 10 місяців тому

      I think that using a set is much cleaner then using nested loops. score = len(winning_numbers & scratch_numbers) a a single line, and probably much quicker.