@immiao My understanding for greedy algorithm is that there could be multiple optimum solutions for the problem, and the greedy solution can find one of them. In this algorithm, every steps maintains the invariant that current intervals in the queue represents the minimum numbers of rooms needed because they are all in conflict with each other. We should be able to use induction to prove that assuming in kth step, the queue maintains minimum number of rooms needed, and in k+1 step the queue still maintains the invariant property, we can conclude the correctness of the algorithm.

Meeting Rooms II