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 gap without overlap.

  • Iterate through presentations and calculate the gaps between them

  • Sort presentations by end time and reschedule K presentations to max...read more

Help your peers!
Select
Add answer anonymously...

Uber Software Developer Intern interview questions & answers

A Software Developer Intern was asked 9mo agoQ. Changes on graph structure
A Software Developer Intern was asked Q. Find Indices for Local Minima and Maxima Given an integer array arr of size N, y...read more
A Software Developer Intern was asked Q. Return Subsets Sum to K Problem Statement Given an integer array 'ARR' of size '...read more

Popular interview questions of Software Developer Intern

A Software Developer Intern was asked Q1. Find Indices for Local Minima and Maxima Given an integer array arr of size N, y...read more
A Software Developer Intern was asked Q2. Return Subsets Sum to K Problem Statement Given an integer array 'ARR' of size '...read more
A Software Developer Intern was asked Q3. Game of Stones Problem Statement Two players, 'Ale' and 'Bob', are playing a gam...read more
Uber Software Developer Intern 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