Maximum Meetings Selection
You are tasked with scheduling meetings in a single meeting room. Given N
meetings, each with a start time Start[i]
and end time End[i]
, determine the maximum number of meetings that can be held in the room. Return the indices of these meetings, prioritizing meetings with earlier end times and, for the same end time, those with smaller indices.
Input:
The first line contains an integer 'T' denoting the number of test cases.
For each test case:
The first line contains an integer 'N' representing the number of meetings.
The second line contains N space-separated integers indicating the start times of the meetings.
The third line contains N space-separated integers indicating the end times of the meetings.
Output:
For each test case, output the indices (1-based) of the meetings that can be scheduled, ordered by the sequence they are held.
Example:
Input:
2
3
1 2 3
2 3 4
3
1 3 0
2 4 5
Output:
1 2
3 1
Constraints:
1 <= T <= 5
1 <= N <= 10^5
0 <= Start[i] < End[i] <= 10^9
Note:
No need to handle any printing in your function; focus on logic implementation.

AnswerBot
4mo
Given start and end times of meetings, find the maximum number of meetings that can be scheduled in a single room.
Sort the meetings based on their end times in ascending order.
Iterate through the sort...read more
Help your peers!
Add answer anonymously...
Nagarro SDE interview questions & answers
A SDE was asked Q. Duplicate Subtrees Problem Statement Given a binary tree, return the root values...read more
A SDE was asked Q. Maximum Meetings Selection You are tasked with scheduling meetings in a single m...read more
A SDE was asked Q. Can you explain the concept of keys in database management systems?
Popular interview questions of SDE
A SDE was asked Q1. Duplicate Subtrees Problem Statement Given a binary tree, return the root values...read more
A SDE was asked Q2. Maximum Meetings Selection You are tasked with scheduling meetings in a single m...read more
A SDE was asked Q3. Can you explain the concept of keys in database management systems?
Stay ahead in your career. Get AmbitionBox app


Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+
Reviews
10L+
Interviews
4 Cr+
Salaries
1.5 Cr+
Users
Contribute to help millions
AmbitionBox Awards
Get AmbitionBox app

