Asked inNagarro,SDE

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.

Be the first one to answer
Add answer anonymously...
Nagarro SDE Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter