combination, filter_map - Day 11 - Advent of Code

Sdílet
Vložit
  • čas přidán 10. 12. 2023
  • Join me as we traverse the cosmos while solving Day 11 of Advent of Code 2023 - Cosmic Expansion - in Ruby!
    In this coding galaxy quest, we'll:
    Parse an image grid of galaxies and empty space
    Expand the grid by inserting extra rows and columns
    Find all galaxy locations and calculate distances
    Generate combinations of galaxies to compare
    Refactor distance to handle cosmic doubling
    Scale empty spaces to multiply distances
    The solution handles parsing the image input and initially expanding it. We then pivot to a calculation-based approach without materializing massive arrays. Some elegant Ruby built in methods like combination and inject help compare galaxy pairs.
    Advent of Code: adventofcode.com/
    My Solutions: gist.github.com/cjavdev/d15a2...
    Playlist • Advent of Code
    #adventofcode #ruby
  • Jak na to + styl

Komentáře •