Bird
Raised Fist0

Given the following partial event list after sorting for minimum platforms calculation: [(900, 1), (910, -1), (940, 1), (950, 1), (1120, -1), (1200, -1)] What was the original arrivals and departures input arrays?

hard🔄 Reverse Engineer Q9 of Q15
Intervals - Minimum Number of Platforms Required
Given the following partial event list after sorting for minimum platforms calculation: [(900, 1), (910, -1), (940, 1), (950, 1), (1120, -1), (1200, -1)] What was the original arrivals and departures input arrays?
AArrivals: [900, 940, 1120], Departures: [910, 950, 1200]
BArrivals: [900, 910, 940], Departures: [950, 1120, 1200]
CArrivals: [900, 940, 950], Departures: [910, 1120, 1200]
DArrivals: [900, 950, 1120], Departures: [910, 940, 1200]
Step-by-Step Solution
Solution:
  1. Step 1: Separate arrivals and departures

    Events with 1 are arrivals: 900, 940, 950; with -1 are departures: 910, 1120, 1200.
  2. Step 2: Verify order

    Arrivals and departures match Arrivals: [900, 940, 950], Departures: [910, 1120, 1200] exactly.
  3. Final Answer:

    Option C -> Option C
  4. Quick Check:

    Event types map directly to arrivals and departures [OK]
Quick Trick: Event type 1 -> arrival; -1 -> departure [OK]
Common Mistakes:
MISTAKES
  • Mixing arrival and departure times in options
Trap Explanation:
PITFALL
  • Candidates confuse event types or order, picking wrong input arrays.
Interviewer Note:
CONTEXT
  • Tests ability to reverse engineer input from intermediate algorithm state.
Master "Minimum Number of Platforms Required" in Intervals

3 interactive learning modes - each teaches the same concept differently

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Intervals Quizzes