Minimum Delivery Executives for Overlapping Slot Bookings

Last updated: November 29, 2026

Quick Overview

Each delivery booking has a start and end time within the day. Return the minimum number of delivery executives needed so that no executive handles two overlapping bookings.

Flipkart
Coding & Algorithms
Software Engineer
Flipkart
November 29, 2026
Software Engineer
Onsite
Coding & Algorithms
Medium

0

0

0 solved


Each delivery booking has a start and end time within the day. Return the minimum number of delivery executives needed so that no executive handles two overlapping bookings.

A common Flipkart onsite problem dressed in Ekart last mile logistics: slot based deliveries for large appliances need dedicated executives. The interviewer wants the sweep line or min heap insight and a clear rule for bookings that touch at an endpoint.

What the Interviewer Expects
  • Clarify whether a booking ending at 10:00 conflicts with one starting at 10:00
  • Sort by start time and use a min heap of end times, or sweep sorted start and end events
  • Explain why the max concurrent count equals the answer
  • Give O(n log n) time
  • Extend to returning which executive gets which booking
Key Topics to Cover
sweep line
min heap
interval scheduling
sorting
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • How would you assign actual executive IDs to each booking?
  • What if each executive also needs 15 minutes of travel between bookings?
  • How would the answer change if bookings come online and you cannot sort them in advance?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements
  • Input: list of (start, end) in minutes since midnight.
  • Treat intervals as half open [start, end): a booking ending at 600 frees the executive for one starting at 600. Confirm this with the int...
High-Level Design

The answer equals the maximum number of bookings in progress at any instant. Sort bookings by start. Keep a min heap of end times for executives currently busy. For each booking, if the earliest finis...


Submit Your Answer
Markdown supported