Error
|
|
---|---|
@Ibrahim Nash | 6381 |
@blackshadows | 6329 |
@mb1973 | 5388 |
@Quandray | 5231 |
@akhayrutdinov | 5111 |
@saiujwal13083 | 4510 |
@sanjay05 | 3762 |
@marius_valentin_dragoi | 3522 |
@sushant_a | 3459 |
@verma_ji | 3357 |
@KshamaGupta | 3318 |
Complete Leaderboard | |
|
|
@1905439 | 553 |
@terabaap123 | 508 |
@smitadiwedi1991 | 279 |
@DevanandJayakumar | 250 |
@atishagusain | 244 |
@gupta_10 | 226 |
@nipun edara | 224 |
@shubhamkhullar7 | 224 |
@sharmachandan487 | 204 |
@balunagar | 204 |
@arshjit_singh7 | 190 |
Complete Leaderboard |
There is one meeting room in a firm. There are N meetings in the form of (S[i], F[i]) where S[i] is start time of meeting i and F[i] is finish time of meeting i.
What is the maximum number of meetings that can be accommodated in the meeting room when only one meeting can be held in the meeting room at a particular time? Also note start time of one chosen meeting can't be equal to the end time of the other chosen meeting.
Example 1:
Input:
N = 6
S[] = {1,3,0,5,8,5}
F[] = {2,4,6,7,9,9}
Output:
4
Explanation:
Four meetings can be held with
given start and end timings.
Example 2:
Input:
N = 8
S[] = {75250, 50074, 43659, 8931, 11273,
27545, 50879, 77924}
F[] = {112960, 114515, 81825, 93424, 54316,
35533, 73383, 160252}
Output:
3
Explanation:
Only three meetings can be held
with given start and end timings.
Your Task :
You don't need to read inputs or print anything. Complete the function maxMeetings() that recieves array S[ ] and F[ ] along with their size N as input parameters and returns the maximum number of meetings that can be held in the meeting room.
Expected Time Complexity : O(N*LogN)
Expected Auxilliary Space : O(N)
Constraints:
1 ≤ N ≤ 105
0 ≤ S[i] < F[i] ≤ 105
We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?
Yes