[LeetCode]Meeting Rooms

public class Solution {
    public boolean canAttendMeetings(Interval[] intervals) {
        Arrays.sort(intervals, new Comparator<Interval>() {
            public int compare(Interval o1, Interval o2) {
                return o1.start - o2.start;
            }
        });
        Interval pre = new Interval(-1, -1);
        for (Interval inte: intervals) {
            if (inte.start < pre.end) {
                return false;
            }
            pre = inte;
        }
        return true;
    }
}

 

posted @ 2015-12-01 15:06  Weizheng_Love_Coding  阅读(124)  评论(0编辑  收藏  举报