Day 4: Scratchcards | Advent of Code 2023

Поделиться
HTML-код
  • Опубликовано: 16 янв 2025

Комментарии • 3

  • @TheFrogfather1
    @TheFrogfather1 Год назад +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 Год назад +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 Год назад

      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.