# AUG!!! No heap, but the same idea, O(n2), beats 88%, in JAVA with some comments.

• ``````    /** IDEA
* create a "Room" class to keep tracking its last end of use time
* when the current interval's start is greater than a room's last end time
* then this room is available and update its last end of use time-stamp
* if there is no room available, ask for a new room for the current meeting;
* return the size of total rooms needed;
*/
public class Solution {
class Room {
int lastMeetingEnd;
Room(int time) {
lastMeetingEnd = time;
}
}

public int minMeetingRooms(Interval[] intervals) {
List<Room> rooms = new ArrayList<>();
Arrays.sort(intervals, new Comparator<Interval>() {
public int compare(Interval in1, Interval in2) {
if (in1.start != in2.start) {
return in1.start - in2.start;
} else {
return in1.end - in2.end;
}
}
});
int totalRooms;
int roomNum = 0;
Interval current;
for (int index = 0; index < intervals.length; index++) {
current = intervals[index];
if (rooms.isEmpty()) {
} else {
totalRooms = rooms.size();
roomNum = 0;
for (; roomNum < totalRooms; roomNum++) {
if (rooms.get(roomNum).lastMeetingEnd <= current.start) {
rooms.get(roomNum).lastMeetingEnd = current.end;
break;
}
if (roomNum == totalRooms - 1) {
break;
}
}
}
}
return rooms.size();
}
}``````

• What does the yelled "AUG!!!" in all your titles mean? Annoying Useless Garbage? That would fit, as "AUG!!!" doesn't seem to contain any useful information.

• @ManuelP
Oh man, does it bother you? do you really want to know why? Do you even care or you just have a bad day?
It's my personal mark and part of my name. I can stop using it if you want me to. But "it's useless garbage" is definitely not a good reason and it sounds really rude to me.
Hey, I am a coder, I am happy coding and love to share. I really do not want to bring any trouble to any readers or peers. If you still feel uncomfortable with the title or me if it is possible, please leave your comment and I would be glad to make a change for a good reason.
Have a good day buddy. Happy coding.

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.