Meeting Rescheduling Challenge

Ninja is tasked with organizing a meeting in an office that starts at time ‘0’ and ends at time ‘LAST’. There are ‘N’ presentations scheduled with given start and end times. The presentations do not overlap. Your task is to help Ninja by rescheduling at most ‘K’ presentations while maintaining the original order, aiming to maximize the longest period without any scheduled presentation.

Explanation:

You are allowed to reschedule, but not alter the durations of, at most ‘K’ presentations to achieve the longest possible gap without presentations during the designated meeting time.

Example:

Input:
T = 1
N = 3, K = 1, LAST = 10
START = [0, 2, 5]
END = [1, 3, 6]
Output:
3

Constraints:

  • 1 <= T <= 10
  • 1 <= N <= 5000
  • 0 <= K <= N
  • 0 <= LAST <= 10^9
  • START[i] < END[i], for 1 <= i <= N
  • END[i] <= START[i+1], for 1 <= i < N

Note:

You do not need to print anything as it has already been handled. Simply implement the specified function to derive the solution.

AnswerBot
4mo

Reschedule at most K presentations to maximize longest gap without overlap.

  • Iterate through presentations and calculate the gap between each pair of presentations

  • Sort the presentations by their start t...read more

Help your peers!
Select
Add answer anonymously...

Cvent Software Developer interview questions & answers

A Software Developer was asked Q. How do you handle problems?
A Software Developer was asked Q. Lowest Common Ancestor (LCA) Problem Statement Understanding the concept of Lowe...read more
A Software Developer was asked Q. Remove Duplicates from String Problem Statement You are provided a string STR of...read more

Popular interview questions of Software Developer

A Software Developer was asked Q1. How do you handle problems?
A Software Developer was asked Q2. Lowest Common Ancestor (LCA) Problem Statement Understanding the concept of Lowe...read more
A Software Developer was asked Q3. Remove Duplicates from String Problem Statement You are provided a string STR of...read more
Cvent Software Developer Interview Questions
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
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

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

Follow Us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Profile Image
Hello, Guest
AmbitionBox Employee Choice Awards 2025
Winners announced!
awards-icon
Contribute to help millions!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
Add office benefits
Add office benefits