This is our solution and implementation to problem #253: Meeting Rooms II on LeetCode.
Our code is written in Java. If you want to code your solution in a different language, no worries, as the core concepts will carry over from language to language. This page includes our analysis of the problem, our implementation strategy a breakdown on the space and time complexity, and the full code implementation.
If you would like to view the original problem and solve it, please visit: Meeting Rooms II on LeetCode.
Problem Analysis
We need to determine how many conference rooms are required, but we don't necessarily need to actually make those assignments. We only need to determine the maximum number of overlaps at any given time.
We can gain insight into the problem by visualizing the meetings in different ways. If you were to draw a line on a chart representing each meeting's duration, the maximum number of stacked lines represents the minimum number of conference rooms.
For example:
Full Code
Our solution is given in the Java code below:
All of our solutions are hosted on GitHub. The code on this page was pulled from the repo.