← Back to Index

Day 4: Part 1

Problem Description

The challenge was to determine the number of overlapping ranges from a list of pairs. Each pair represents a range, and the goal is to count how many of these ranges overlap with each other.

Approach

To solve this problem, I implemented the following steps:
1. Input Reading: I read the input data from a file, which contains pairs of ranges.
2. Range Parsing: I parsed the input to extract the start and end points of each range, storing them in a list of tuples.
3. Overlap Checking: I iterated through each pair of ranges, checking if they overlap by comparing their start and end points.
4. Count Overlaps: I maintained a count of how many ranges overlap and printed the final count.

This approach is straightforward and effectively checks for overlaps.

Key Insights

Concepts and Algorithms Used