Handle Score
@Ibrahim Nash 5725
@blackshadows 5685
@akhayrutdinov 5111
@mb1973 4989
@Quandray 4908
@saiujwal13083 4156
@sanjay05 3762
@marius_valentin_dragoi 3511
@sushant_a 3453
@KshamaGupta 3318
@the_coder95 3302
Complete Leaderboard
N meetings in one room
Easy Accuracy: 23.0% Submissions: 3054 Points: 2

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? Also note start time of one chosen meeting can't be equal to the end time of the other chosen meeting.

Example 1:

N = 6
S[] = {1,3,0,5,8,5}
F[] = {2,4,6,7,9,9}
Output: 1 2 4 5
Explanation: Four meetings can held with
given start and end timings.

Example 2:

N = 8
S[] = {75250,50074,43659,8931,11273,
F[] = {112960,114515,81825,93424,
Output: 6 7 1
Explanation: Only three meetings can held
with given start and end timings.

Your Task :

You don't need to read inputs. Complete the function maxmeetings() that recieves start and end array along with their size and prints all the meeting numbers (1-based indexing). 

1 ≤ N ≤ 105
0 ≤ S[i] < F[i] ≤ 105

Expected Time Complexity : O(NlogN)
Expected Auxilliary Space : O(N)

Note: For same end time the meeting with small index will be prefered.

to report an issue on this page.


We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?


All Submissions

My Submissions:

Login to access your submissions.

N meetings in one room

Output Window