> For the complete documentation index, see [llms.txt](https://851958789.gitbook.io/notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://851958789.gitbook.io/notes/0253_meeting_rooms_ii/slt.md).

# 思路1 min heap

1 按照 开始时间 对会议进行排序。

2 初始化一个新的 最小堆，将第一个会议的结束时间加入到堆中。我们只需要记录会议的结束时间，告诉我们什么时候房间会空。堆中的值是会议的结束时间

3 对每个会议，检查堆的最小元素（即堆顶部的房间）是否空闲。 如果空闲，则将其弹出。不再占用heap。 然后将新的会议的结束时间放入heap

4 处理完所有会议后，堆的大小即为开的房间数量。这就是容纳这些会议需要的最小房间数。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://851958789.gitbook.io/notes/0253_meeting_rooms_ii/slt.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
