Javascript Solution (100%)


  • 0
    A
    var minMeetingRooms = function(intervals) {
        let rooms = 0;
        let endItr = 0;
        let startArr = [];
        let endArr = [];
    
         Object.keys(intervals).forEach(function(key) {
             startArr.push(intervals[key].start);
             endArr.push(intervals[key].end);
         });
    
         startArr.sort((a, b) => a - b);
         endArr.sort((a, b) => a - b);
    
         Object.keys(intervals).forEach(function(key) {
             if (startArr[key] < endArr[endItr]) {
                 if (startArr[key] < endArr[key]) {
                     rooms++;
                 }
             } else {
                 endItr++;
             }
         });
    
         return rooms;
     };

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.