@@ -85,41 +85,6 @@ std::vector<Range> Range::And(const std::vector<Range>& left, const std::vector<
8585
8686 return results;
8787}
88- // std::vector<Range> MergeSortedAsPossible(const std::vector<Range>& ranges) {
89- // if (ranges.empty() || ranges.size() == 1) {
90- // return ranges;
91- // }
92- // std::vector<Range> results;
93- // Range current = ranges[0];
94-
95- // for (size_t i = 1; i < ranges.size(); ++i) {
96- // Range next = ranges[i];
97- // // Try to merge current and next
98- // std::optional<Range> merged = Range::Union(current, next);
99- // if (merged) {
100- // // Merged successfully
101- // current = merged;
102- // } else {
103- // // Cannot merge: add current to result and move to next
104- // results.push_back(merged);
105- // current = next;
106- // }
107- // }
108- // // Add the last range
109- // results.push_back(current);
110- // return results;
111- // }
112-
113- // std::optional<Range> Range::Union(const Range& left, const Range& right) {
114- // if (left.from <= right.from) {
115- // if (left.to + 1 >= right.from) {
116- // return Range(left.from, std::max(left.to, right.to));
117- // }
118- // } else if (right.to + 1 >= left.from) {
119- // return Range(right.from, std::max(left.to, right.to));
120- // }
121- // return std::nullopt;
122- // }
12388
12489std::optional<Range> Range::Intersection (const Range& left, const Range& right) {
12590 int64_t start = std::max (left.from , right.from );
0 commit comments