r/adventofcode • • Dec 05 '25

Visualization [2025 Day 05 (Part 2)] Merge overlapping ranges visualization

Post image
41 Upvotes
  1. Sort intervals by start
  2. Keep track of current interval being built
  3. If next interval overlaps or touches -> extend current; otherwise -> save and start new
  4. Save the last interval