Skip to content

LeetCode 56. Merge Intervals#45

Merged
huyfififi merged 7 commits intomainfrom
leetcode-56-merge-intervals
Jan 21, 2026
Merged

LeetCode 56. Merge Intervals#45
huyfififi merged 7 commits intomainfrom
leetcode-56-merge-intervals

Conversation

@huyfififi
Copy link
Owner

@huyfififi huyfififi self-assigned this Jan 20, 2026
@huyfififi huyfififi force-pushed the leetcode-56-merge-intervals branch from 7d32984 to dd7f2e7 Compare January 20, 2026 05:11
@huyfififi huyfififi marked this pull request as ready for review January 20, 2026 05:25
@huyfififi huyfififi merged commit 2f0f87c into main Jan 21, 2026
@huyfififi huyfififi deleted the leetcode-56-merge-intervals branch January 21, 2026 20:58
それでも完全にしっくりと意味と名前を対応させられている感じはなんだかしないのだが。
Step 1 は説明的であることを心がけたが、読まなければいけない行数が多いので逆に読みにくいかもしれない。

`std::vector<std::vector<int>> sorted_intervals(intervals);`の時点では厳密にはソートされていないので名前とのチグハグ感があるが、他に良い案も思いつかなかった。ソートするまでの処理と、続く処理の間に一行空行を挟んでいるので誤解はないと思うが。
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

これは特に問題ないと思います。

}
}

merged_intervals.push_back(last_interval);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

これを不要とするために last_interval の代わりに、merged_intervals.last() で代用する手はあるんですが、こっちのほうがいいかもしれませんね。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants