In solution/code video of Party Halls problem, they’ve used two different array to store Start Time and End Time and sorted them separately. In this way it can happen that they don’t get sort in the same order (like start time of a party aligns to end time of party). Won’t this would be a issue ?
Won't Sorting start time and end time separately will create some problems?
Yes this can happen and this was also explained in the dry run, it’s a problem which is modified version of activity selection problem. Here just think like a manager that you have given a set of starting & ending time of a party in an increasing order, where you have to avail a hall for party1 and you have also given another time for starting of party2. Now if the ending time of the party1 is less then or equal to starting time of party2 , then you can ask everyone from party1 that please leave the hall cause party2 is about too start.
But if party1 people want to spend more time while partying, what you can do is open another hall for party2 people and ask them to join it here.
Now this case will also happen
where
p1 {start=2, end =10}
p2 {start=3, end = 4}
so now you will see
start = {2,3}
end = {4,10}
But here also same thing is judged that if end time is less then equal to starting time of other party you let it organise. Irrespective of alignment which you were asking.
If have any more doubts left, feel free to ask.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.