Divide Intervals Into Minimum Number of Groups
Divide Intervals Into Minimum Number of Groups Leetcode Problem Divide Intervals Into Minimum Number of Groups is very much similar to the number-of-the-smallest-unoccupied-chair Here we have to divide the given intervals into minimum number of groups such that each interval is in exactly one group, and no two intervals that are in the same group intersect each other. Solution: We will think each interval as combination of two events , startTime and endTime. 1) We create a list of events and then sort that list. 2) After that, we Initialise a min heap. which can be thinked like different baskets or groups. 3) We iterate through the events one by one, and assign each events to groups (picked from minheap). While iterating starting event we pick a group from min heap and keep track in an array. While iterating ending event through our tracking array, we release the group again in min...