@@ -0,0 +1,1313 @@
+package com.freetymekiyan.algorithms.level.easy;%0A%0Aimport java.util.Arrays;%0A%0A/**%0A * Given an array of meeting time intervals consisting of start and end times %5B%5Bs1,e1%5D,%5Bs2,e2%5D,...%5D (si %3C ei), determine%0A * if a person could attend all meetings.%0A * %3Cp%3E%0A * For example,%0A * Given %5B%5B0, 30%5D,%5B5, 10%5D,%5B15, 20%5D%5D,%0A * return false.%0A * %3Cp%3E%0A * Company Tags: Facebook%0A * Tags: Sort%0A * Similar Problems: (H) Merge Intervals, (M) Meeting Rooms II%0A */%0Apublic class MeetingRooms %7B%0A%0A    /**%0A     * Sort.%0A     * The actual problem is detecting whether there is any overlap between meetings.%0A     * Sort the intervals.%0A     * From second interval, check each interval with the previous one.%0A     * If current interval's start %3C previous interval's end, return false.%0A     */%0A    public boolean canAttendMeetings(Interval%5B%5D intervals) %7B%0A        Arrays.sort(intervals, (i1, i2) -%3E i1.start - i2.start);%0A        for (int i = 1; i %3C intervals.length; i++) %7B%0A            if (intervals%5Bi%5D.start %3C intervals%5Bi - 1%5D.end) %7B%0A                return false;%0A            %7D%0A        %7D%0A        return true;%0A    %7D%0A%0A    public class Interval %7B%0A%0A        int start;%0A        int end;%0A%0A        Interval() %7B%0A            start = 0;%0A            end = 0;%0A        %7D%0A%0A        Interval(int s, int e) %7B%0A            start = s;%0A            end = e;%0A        %7D%0A    %7D%0A%0A%7D%0A

add meeting rooms