Maximum Meetings Problem Statement

Given the schedule of N meetings with their start time Start[i] and end time End[i], you need to determine which meetings can be organized in a single meeting room such that the total number of organized meetings is maximized.

Input:

The first line contains an integer 'T' representing the number of test cases.
For each test case:
- The first line contains an integer 'N' denoting the number of meetings.
- The second line contains N space-separated integers denoting the start times of the meetings.
- The third line contains N space-separated integers denoting the end times of the meetings.

Output:

For each test case, return the meeting numbers (1-based indexing) that can be organized in the room maximizing the number of meetings. The meetings should be returned in the order they are organized.

Example:

Suppose there is 1 test case with 3 meetings where:

Input:

N = 3
Start = [1, 2, 3]
End = [2, 3, 4]

Output:

[1, 2, 3]

Explanation: All meetings can be organized consecutively without overlap.

Constraints:

  • 1 <= T <= 5
  • 1 <= N <= 105
  • 0 <= Start[i] < End[i] <= 109
  • Time Limit: 1 sec

Note:

The start time of one chosen meeting cannot be equal to the end time of another chosen meeting. For meetings ending at the same time, the one with a smaller index is preferred.

Be the first one to answer
Add answer anonymously...
Nagarro Software Developer 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