Showing:
Handle Score
@Ibrahim Nash 5725
@akhayrutdinov 5111
@mb1973 4989
@Quandray 4908
@saiujwal13083 4156
@sanjay05 3762
@marius_valentin_dragoi 3511
@sushant_a 3453
@KshamaGupta 3318
@the_coder95 3302
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:

Input:
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:

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

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).

Constraints:
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.