Skip to content

Create 0253-meeting-rooms-ii.md - #57

Open
naoto-iwase wants to merge 2 commits into
mainfrom
0253-meeting-rooms-ii
Open

Create 0253-meeting-rooms-ii.md#57
naoto-iwase wants to merge 2 commits into
mainfrom
0253-meeting-rooms-ii

Conversation

@naoto-iwase

Copy link
Copy Markdown
Owner

@naoto-iwase naoto-iwase mentioned this pull request Nov 3, 2025
class Solution:
def min_meeting_rooms(self, intervals: list[Interval]) -> int:
start_order = sorted(intervals, key=lambda x: x.start)
min_heap = [] # rooms' end time

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

自分だったらコメントと変数名を入れ替えると思います。
L129 を見た時に min_heap[0] <= interval.start であるより rooms_end_time[0] <= interval.start の方が意味がとりやすそうです。L130, 132 は heapq の関数を使っているので対象が heap であることは変数名を変えても理解できるはずです。

used -= 1
j += 1

return max_used

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

もう少しコメントの内容を反映させた変数名にした方が間違えにくいと思いました。
starts -> start_times, i -> start_index のような感じです。

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