Comment on
❄️ - 2023 DAY 10 SOLUTIONS -❄️
Used Shoelace Algorithm to get the interior area and then Pick's Theorem to get the number of interior points based on the area and the points along the boundary loop.
Comment on
❄️ - 2023 DAY 10 SOLUTIONS -❄️
Used Shoelace Algorithm to get the interior area and then Pick's Theorem to get the number of interior points based on the area and the points along the boundary loop.
Comment on
💓 - 2023 DAY 20 SOLUTIONS - 💓
Memories of Day 8. It took me too long to realize I forgot to remove the 1000 iteration limit for part two.
Comment on
🍪 - 2023 DAY 7 SOLUTIONS -🍪
Took me way too long to realize I could simply add jokers to the count of the most common card in the hand.
Comment on
💃 - 2025 DAY 6 SOLUTIONS - 💃
I decided to rotate the entire input character-by-character, then parse the numbers (see the full source here)
grid = input.lines.map(&:chomp).map {|l| l.each_char.map.to_a }.to_a
transposed = Array.new(grid[0].length) { Array.new(grid.length) }
grid.each_with_index do |row, y|
row.each_with_index do |col, x|
transposed[x][y] = col
end
end
vals = []
ops = []
temp_vals = []
transposed.each do |row|
l = row.join("").strip
temp_vals << l.scan(/\d+/).map(&:to_i).to_a[0]
/[+*]/.match(l) { |m| ops << m.to_s.to_sym }
if l == ""
vals << temp_vals.compact
temp_vals = []
end
end
vals << temp_vals.compact unless temp_vals.empty?
vals.each_with_index.sum do |v, i|
v.inject(ops[i])
end
Comment on
⏳ - 2023 DAY 22 SOLUTIONS -⏳
Comment on
☃️ - 2023 DAY 11 SOLUTIONS - ☃️
Multiplied the manhattan distance by the number of empty space lines crossed.
Comment on
👣 - 2023 DAY 23 SOLUTIONS -👣
For Part One I used a depth-first search which took too long for part two. Part Two I created an adjacency list of the junction points while keeping track of the distance to the adjacent nodes at the same time. Then depth-first search through the adjacency list.
Comment on
🌚 - 2024 DAY 4 SOLUTIONS - 🌚
Blunt force grid navigation https://gitlab.com/landreville/advent-of-code-2024/-/blob/main/src/bin/04.rs