Skip to content

Commit 3c05c05

Browse files
authored
Merge pull request #1050 from agnihotriketan/patch-15
Create 252-Meeting-Rooms.cs
2 parents 352cc8a + 5b29bd7 commit 3c05c05

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

csharp/252-Meeting-Rooms.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
public class Solution {
2+
public bool CanAttendMeetings(int[][] intervals) {
3+
4+
Array.Sort(intervals, (a, b) => a[0] < b[0] ? -1 : 1);
5+
for (int i = 1; i < intervals.Length; i++)
6+
{
7+
if (intervals[i][0] < intervals[i - 1][1])
8+
{
9+
return false;
10+
}
11+
}
12+
return true;
13+
}
14+
}

0 commit comments

Comments
 (0)