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...
Top SDE Interview Questions Asked at Nagarro
Q. Duplicate Subtrees Problem Statement Given a binary tree, return the root values...read more
Q. Can you explain the concept of keys in database management systems?
Q. Merge k Sorted Linked Lists You are provided with 'K' sorted linked lists, each ...read more
Interview Questions Asked to SDE at Other Companies
Top Skill-Based Questions for Nagarro SDE
Data Structures Interview Questions and Answers
250 Questions
Algorithms Interview Questions and Answers
250 Questions
Web Development Interview Questions and Answers
250 Questions
Operating Systems Interview Questions and Answers
250 Questions
System Design Interview Questions and Answers
250 Questions
C++ Interview Questions and Answers
150 Questions
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

