Create 0253-meeting-rooms-ii.md - #57
Open
naoto-iwase wants to merge 2 commits into
Open
Conversation
Closed
tokuhirat
reviewed
Nov 4, 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 |
There was a problem hiding this comment.
自分だったらコメントと変数名を入れ替えると思います。
L129 を見た時に min_heap[0] <= interval.start であるより rooms_end_time[0] <= interval.start の方が意味がとりやすそうです。L130, 132 は heapq の関数を使っているので対象が heap であることは変数名を変えても理解できるはずです。
tokuhirat
reviewed
Nov 4, 2025
| used -= 1 | ||
| j += 1 | ||
|
|
||
| return max_used |
There was a problem hiding this comment.
もう少しコメントの内容を反映させた変数名にした方が間違えにくいと思いました。
starts -> start_times, i -> start_index のような感じです。
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.
元の問題(premium):https://leetcode.com/problems/meeting-rooms-ii/
この問題(LINTCODE):https://www.lintcode.com/problem/919/
次の問題:https://leetcode.com/problems/is-subsequence/