Bird
Raised Fist0

Given the final output of interval intersections: [[1,2],[5,5],[8,10],[15,23],[24,24],[25,25]], which of the following could be the original input lists A and B?

hard🔄 Reverse Engineer Q9 of Q15
Intervals - Interval List Intersections
Given the final output of interval intersections: [[1,2],[5,5],[8,10],[15,23],[24,24],[25,25]], which of the following could be the original input lists A and B?
AA=[[0,1],[5,10],[13,23],[24,25]], B=[[1,2],[5,5],[8,12],[15,24],[25,26]]
BA=[[1,2],[5,5],[8,10],[15,23],[24,24],[25,25]], B=[[0,2],[5,10],[13,23],[24,25]]
CA=[[0,5],[8,12],[15,24],[25,26]], B=[[0,2],[5,10],[13,23],[24,25]]
DA=[[0,2],[5,10],[13,23],[24,25]], B=[[1,5],[8,12],[15,24],[25,26]]
Step-by-Step Solution
Solution:
  1. Step 1: Match output intervals to inputs

    Output intervals correspond exactly to intersections of A=[[0,2],[5,10],[13,23],[24,25]] and B=[[1,5],[8,12],[15,24],[25,26]].
  2. Step 2: Verify intervals

    Each output interval is the overlap of intervals from these lists, confirming correctness.
  3. Final Answer:

    Option D -> Option D
  4. Quick Check:

    Output matches known example input [OK]
Quick Trick: Output intervals are intersections of input intervals [OK]
Common Mistakes:
MISTAKES
  • Confusing input order
  • Assuming output equals input
Trap Explanation:
PITFALL
  • Candidates may confuse which list is A or B or think output intervals are inputs.
Interviewer Note:
CONTEXT
  • Tests deep understanding by reasoning backwards from output to input.
Master "Interval List Intersections" 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