python intermediate 2026-11-17 को समाप्त

Merge overlapping intervals

Booking systems often need to merge busy time slots. Write merge(intervals) that takes a list of (start, end) pairs and returns a new list where overlapping or touching intervals are merged, sorted by start.

  • [(1, 3), (2, 6), (8, 10)] becomes [(1, 6), (8, 10)].
  • Touching counts as overlapping: [(1, 2), (2, 4)] becomes [(1, 4)].
  • The input may be unsorted; don't modify it.

Acceptance criteria

  • An empty list returns [].
  • The tests at the bottom print All tests passed.

अब तक 0 लोगों ने हल किया।

python
एडिटरCtrl + Enter

            
        

जब टेस्ट "All tests passed" दिखाते हैं, तो चैलेंज इस ब्राउज़र में हल के रूप में चिह्नित हो जाता है।

अपना समाधान समीक्षा के लिए भेजें