Advent of Code 2024 Day 19

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

КОМЕНТАРІ • 16

  • @mikelikesrobots
    @mikelikesrobots 2 дні тому

    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 4 дні тому +3

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

  • @acquite
    @acquite 5 днів тому +4

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

  • @DavidDeininger
    @DavidDeininger 4 дні тому +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 😂

  • @Erwipro
    @Erwipro 5 днів тому

    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.

  • @joule162534
    @joule162534 4 дні тому

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

  • @harisimer
    @harisimer 4 дні тому

    i never understood why its called dynamic programming

  • @rastislavsvoboda4363
    @rastislavsvoboda4363 4 дні тому

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

  • @n0ne0ne
    @n0ne0ne 5 днів тому +2

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

  • @yajusgakhar6969
    @yajusgakhar6969 5 днів тому

    When will the Tower of Hanoi stop haunting meee

  • @Bundas102
    @Bundas102 5 днів тому +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 5 днів тому

      can you share your code for p1?

    • @Bundas102
      @Bundas102 5 днів тому +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 5 днів тому +1

      @@Bundas102 Thanks

  • @DavidDeininger
    @DavidDeininger 4 дні тому

    “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 😂