#P1318. 2023.6.2-TikTok春招(澳大利亚区域)-第四题

2023.6.2-TikTok春招(澳大利亚区域)-第四题

4.Resolve Conflicts in Calendar (Australia)

You have received several meeting invitations in your calendar represented by an array meetings.The start and end time of each meeting invitation is indicated as meetings[i] =[starti,endi][start_i,end_i]. Find out the fewest number of meeting invitations to be rejected so that there is no conflicts of meetings in your calendar.

meetings105|meetings| \leq 10^5

Example 1:

Input

4
1 2
2 3
3 4
1 3

Output:

1

**Explanation: **

Reject [1,3] to avoid the conflicts

Example 2:

Input

2
1 2
2 3

Output:

0

Explanation: You don't need to reject any meeting invitations