Day 9: Disk Fragmenter | Advent of Code 2024

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

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

  • @BillyNix
    @BillyNix Месяц назад +1

    I just realized that the original text provides the sizes of free space. No need to count blocks of space available in the structure created in part 1, just subtract free space by the file size and you're left with the remaining free space. That's probably key to getting a more efficient solution.

  • @TheFrogfather1
    @TheFrogfather1 Месяц назад +1

    I got part one and alllllmost part two before work (starting at 5:30) although stupidly left the blocks as strings initially (there's a reason the example only goes up to 9!). At least I remembered to use int64 instead of integer. I didn't realise you had to manually allocate space in Python - or is that just for gigantic structures like we have here?

    • @womogenes
      @womogenes  Месяц назад

      you do have to manually allocate space in python, though it's pretty simple with list multiplication

  • @w1keee
    @w1keee Месяц назад +1

    my part 2 code works for the example input but doesn't for the real input, welp

    • @adamamacdonald
      @adamamacdonald Месяц назад +1

      Are you accounting for the scenario where FileID (867) takes 4 blocks resulting in 867867867867 on the disk?

    • @spoilka666
      @spoilka666 Месяц назад

      same :( Debuged it for hours, tried to rewrite it and stuck

    • @ankitadey9040
      @ankitadey9040 Месяц назад

      Samee. I'm so sure it's quite right but it's stuck for the real input.