Advent of Code 2024 Day 19

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

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

  • @mikelikesrobots
    @mikelikesrobots 6 дней назад

    Thank you for your video! I had the right idea, but the wrong implementation, and your explanation showed me what I was doing wrong and helped me finish my own video. If you want a good laugh, take a look at the length of your code versus what I had written... Good luck hitting sub 100 :D

  • @dickeyy
    @dickeyy 8 дней назад +3

    my solution for today was insanely similar to yours, im proud of myself now

  • @acquite
    @acquite 9 дней назад +4

    omg youre back!!!!!!!!!!

  • @DavidDeininger
    @DavidDeininger 8 дней назад +1

    “Brrwbw” wasn’t in your cache because none of the designs you have happen to end in that string. Only strings you attempt to find end up in the cache. By the way, I solved part 1 differently, by realizing I didn’t need the whole set of 300+ patterns, I could get rid of any pattern that was buildable from other patterns. That brought my set down to a dozen or so. But it didn’t help me solve part 2 😂

  • @joule162534
    @joule162534 8 дней назад

    i have solved it in a completely different way. but this solution is better. glad that i have found the video

  • @harisimer
    @harisimer 8 дней назад

    i never understood why its called dynamic programming

  • @rastislavsvoboda4363
    @rastislavsvoboda4363 8 дней назад

    nice guess, but that was crazy bug, good luck in next days

  • @n0ne0ne
    @n0ne0ne 9 дней назад +2

    That was an unfortunate bug. You would've surely gotten top 100 for p2

  • @Erwipro
    @Erwipro 9 дней назад

    My bug was that I thought you couldn't reuse towels. The input was constructed in a way that this rendered a correct answer for part 1, but obviously not for part 2.

  • @yajusgakhar6969
    @yajusgakhar6969 9 дней назад

    When will the Tower of Hanoi stop haunting meee

  • @Bundas102
    @Bundas102 9 дней назад +2

    Interesting bug there.
    I was too lazy for part1, so I just used regex matching. "^(" + patterns.join('|') + ")*$" does the trick.
    Ocf I had to implement the counting for part2 anyways. First I just did it recursively, then quickly realized, that it won't finish, so I threw my caching wrapper on it.

    • @n0ne0ne
      @n0ne0ne 9 дней назад

      can you share your code for p1?

    • @Bundas102
      @Bundas102 9 дней назад +1

      @@n0ne0ne I did it in JavaScript. inp is an array of the input lines:
      function solve1(inp){
      let c = 0;
      const patterns = inp.shift().split(', ')
      inp.shift()
      const regex = new RegExp("^("+patterns.join('|')+")*$")
      for (const r of inp) {
      if(r.match(regex)) c++
      }
      return c
      }

    • @n0ne0ne
      @n0ne0ne 9 дней назад +1

      @@Bundas102 Thanks

  • @DavidDeininger
    @DavidDeininger 8 дней назад

    “Brrwbw” wasn’t in your cache because none of the designs you have happen to end in that string. Only strings you attempt to find end up in the cache. By the way, I solved part 1 differently, by realizing I didn’t need the whole set of 300+ patterns, I could get rid of any pattern that was buildable from other patterns. That brought my set down to a dozen or so. But it didn’t help me solve part 2 😂