### Problem 1: N Meetings in a room

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

class Solution
{
public:
int maxMeetings(int start[], int end[], int n)
{
pair<int, int> a[n + 1];
for(int i=0; i<n; i++)
{
a[i].first = end[i];
a[i].second = start[i];
}
sort(a, a+n);
int ans = 1, end_time = a[0].first;
for (int i = 1; i < n; i++)
if ( a[i].second > end_time) {
ans++;
end_time = a[i].first;
}
return ans;
}
};