Conversation
oda
reviewed
Apr 21, 2025
Comment on lines
+74
to
+76
| if (intervals == null || intervals.length == 0) { | ||
| return 0; | ||
| } |
There was a problem hiding this comment.
intervals == null はともかく、空ならば特に問題なく0が返りますか?
Owner
Author
There was a problem hiding this comment.
はい、空配列の場合 intervals.length == 0 がtrueとなります。
| - イベント変換: 各会議の開始時刻と終了時刻をそれぞれイベントとして配列に変換する | ||
| - 開始イベント: +1 カウント(会議室使用開始) | ||
| - 終了イベント: -1 カウント(会議室リリース) | ||
| - イベントソート: 両イベント配列を 2D 配列として一つの配列にマージして時刻順(昇順)にソートする。同時刻にイベントが複数存在する場合、終了イベント(-1)を優先する |
There was a problem hiding this comment.
時刻ごとにいくつ増えるか減るか、と思うこともできますね。
全体的に問題ないかと思います。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
問題
https://leetcode.com/problems/meeting-rooms-ii/
言語
Java
次に解く問題
Reverse Linked List