MeetingRoom2

์•Œ๊ณ ๋ฆฌ์ฆ˜ 1. sorting by start time 2. create a PriorityQueue by end time. 3. before.end <= after.start : ํ•ฉ์น˜๊ธฐ before.end > after.start : ํšŒ์˜์‹ค 1๊ฐœ ์ถ”๊ฐ€ ํ•„์š”. 4. ์ตœ์ข…์ ์œผ๋กœ heap์˜ ํฌ๊ธฐ๊ฐ€ ์ •๋‹ต(ํ•„์š”ํ•œ ๋ฏธํŒ…๋ฃธ ๊ฐฏ์ˆ˜)๊ฐ€ ๋œ๋‹ค.

ํ•„์š”ํ•œ ์ž๋ฃŒ๊ตฌ์กฐ : Heap

: BST ๋กœ ๊ตฌ์„ฑ๋œ๋‹ค. ์‹œ๊ฐ„๋ณต์žก๋„๋Š” nlogn end์‹œ๊ฐ„์œผ๋กœ ์˜ค๋ฆ„์ฐจ์ˆœ์œผ๋กœ MinHeap์„ ๊ตฌ์„ฑํ•˜๊ฒŒ ๋˜๋ฉด ์•„๋ž˜์™€ ๊ฐ™๋‹ค.

Last updated

Was this helpful?