Meeting Rooms
Problem Descriptionβ
Visit LeetCode for the full problem description.
Solutionsβ
Solution 1: C# (Best: 108 ms)β
| Metric | Value |
|---|---|
| Runtime | 108 ms |
| Memory | 26.9 MB |
| Date | 2020-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β
| Approach | Time | Space |
|---|---|---|
| Solution | To be analyzed | To be analyzed |