We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test Case: [(25,579),(218,918),(1281,1307),(623,1320),(685,1353),(1308,1358)]
Problem: https://neetcode.io/problems/meeting-schedule-ii
Solution getting accepted:
/** * Definition of Interval: * class Interval { * public: * int start, end; * Interval(int start, int end) { * this->start = start; * this->end = end; * } * } */ class Solution { public: int minMeetingRooms(vector<Interval>& intervals) { sort(intervals.begin(), intervals.end(), [](const Interval &a, const Interval &b){ return a.end < b.end; }); int totalIntervals = intervals.size(); if(totalIntervals == 0) return 0; int daysReq = 1; int lastPointer = 0; for(int intervalIdx = 1; intervalIdx < totalIntervals; intervalIdx++){ Interval interval = intervals[intervalIdx]; if(interval.start < intervals[lastPointer].end){ daysReq++; }else{ lastPointer++; } } return daysReq; } };
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Test Case:
[(25,579),(218,918),(1281,1307),(623,1320),(685,1353),(1308,1358)]
Problem:
https://neetcode.io/problems/meeting-schedule-ii
Solution getting accepted:
The text was updated successfully, but these errors were encountered: