Skip to main content

Meeting Rooms

LeetCode Link

Problem Description​

Visit LeetCode for the full problem description.


Solutions​

Solution 1: C# (Best: 108 ms)​

MetricValue
Runtime108 ms
Memory26.9 MB
Date2020-03-17
Solution
public class Solution {
public bool CanAttendMeetings(int[][] intervals) {
Array.Sort(intervals, new CustomComparer());
for (int i = 0; i < intervals.Length-1; i++)
{
if(intervals[i][1]>intervals[i+1][0])
{
return false;
}
}
return true;
}


public class CustomComparer : IComparer<int[]>
{
public int Compare(int[] x, int[] y)
{
return x[0].CompareTo(y[0]);
}
}
}

Complexity Analysis​

ApproachTimeSpace
SolutionTo be analyzedTo be analyzed