LeetCode #252 - Meeting Rooms
題目描述:
Given an array of meeting time intervals consisting of start and end times [[s1,e1],[s2,e2],...]
(si < ei), determine if a person could attend all meetings.
Example 1:
Input: [[0,30],[5,10],[15,20]]
Output: false
Example 2:
Input: [[7,10],[2,4]]
Output: true
class Solution {
public:
static bool comp(Interval a, Interval b)
{
if(a.start<b.start) return true;
else return false;
}
bool canAttendMeetings(vector<Interval>& intervals) {
sort(intervals.begin(),intervals.end(),comp);
int cur_end=INT_MIN;
for(auto i:intervals)
{
if(i.start<cur_end) return false;
else cur_end=i.end;
}
return true;
}
};
相關文章
- Leetcode 252 Meeting RoomsLeetCodeOOM
- [LeetCode 252] Meeting RoomsLeetCodeOOM
- LeetCode252 Meeting RoomsLeetCodeOOM
- leetcode-252-Meeting RoomsLeetCodeOOM
- 252. Meeting RoomsOOM
- Leetcode 252. Meeting Rooms (Easy) (cpp)LeetCodeOOM
- LeetCode 252. Meeting Rooms (Java版; Easy)LeetCodeOOMJava
- LeetCode 252. Meeting Rooms(會議室)LeetCodeOOM
- [leetcode] 252. Meeting Rooms 解題報告LeetCodeOOM
- Leetcode: Meeting RoomsLeetCodeOOM
- LeetCode-Meeting Rooms IILeetCodeOOM
- [LeetCode 253] Meeting Rooms IILeetCodeOOM
- *LeetCode-Meeting Rooms IILeetCodeOOM
- [LintCode/LeetCode] Meeting RoomsLeetCodeOOM
- [Leetcode]253. Meeting Rooms IILeetCodeOOM
- [LeetCode] Meeting Rooms 會議室LeetCodeOOM
- LeetCode 題解(254) : Meeting RoomsLeetCodeOOM
- [LeetCode253]Meeting Rooms IILeetCodeOOM
- Leetcode 252. Meeting Room 253. Meeting Room IILeetCodeOOM
- Meeting Rooms IIOOM
- LeetCode 253. Meeting Rooms II(會議室)LeetCodeOOM
- 253. Meeting Rooms IIOOM
- Leetcode 253:Meeting Rooms II(超詳細的解法!!!)LeetCodeOOM
- [Leetcode] 253. Meeting Rooms II 解題報告LeetCodeOOM
- leetcode 掃描線專題 06-leetcode.252 meeting room 力扣.252 會議室LeetCodeOOM力扣
- 【LeetCode】253. Meeting Rooms II 解題報告(C++)LeetCodeOOMC++
- Facebook面試題 meeting rooms 求同時最多meeting room的時間面試題OOM
- LeetCode—253.會議室 II(Meeting Rooms II)——分析及程式碼(C++)LeetCodeOOMC++
- [LeetCode] 252、會議室LeetCode
- Leetcode 253: meeting roomLeetCodeOOM
- LeetCode-Best Meeting PointLeetCode
- LeetCode 252. 會議室(排序)LeetCode排序
- 【leetcode】252 會議室(陣列)LeetCode陣列
- LeetCode 題解(252) : Find the Duplicate NumberLeetCode
- LeetCode-Python-252. 會議室LeetCodePython
- Leetcode Meeting room問題系列 - 2LeetCodeOOM
- Leetcode Meeting room問題系列 - 1LeetCodeOOM
- Management of Remote Dependencies (252)REM