DECODE15 - Editorial

PROBLEM LINK:

Practice

Author: Manas Rawat
Tester: Aagam Jain
Editorialist: Manas Rawat

DIFFICULTY:

EASY - MEDIUM

PROBLEM:

You have been given start and end time of some shows and you have to tell the minimum number of laptops required to watch all the shows together.

QUICK EXPLANATION:

To solve this poblem we need a data structure such as a Priority Queue which can store the shows according to the show start time. If the end time of first show and the start time of second show overlap then they have to be played together so we add both shows in the priority queue. But if they don’t overlap then we can remove the first show from the queue and then add the second one.

The maximum size of the priority queue at any moment will denote the minimum number of laptops required.

SOLUTIONS:

Solution can be found here.