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
- LeetCode252 Meeting RoomsLeetCodeOOM
- LeetCode 252. Meeting Rooms (Java版; Easy)LeetCodeOOMJava
- [LintCode/LeetCode] Meeting RoomsLeetCodeOOM
- [Leetcode]253. Meeting Rooms IILeetCodeOOM
- Leetcode 252. Meeting Room 253. Meeting Room IILeetCodeOOM
- Leetcode 253:Meeting Rooms II(超詳細的解法!!!)LeetCodeOOM
- leetcode 掃描線專題 06-leetcode.252 meeting room 力扣.252 會議室LeetCodeOOM力扣
- 253. Meeting Rooms IIOOM
- 【LeetCode】253. Meeting Rooms II 解題報告(C++)LeetCodeOOMC++
- LeetCode—253.會議室 II(Meeting Rooms II)——分析及程式碼(C++)LeetCodeOOMC++
- Leetcode 253: meeting roomLeetCodeOOM
- [LeetCode] 252、會議室LeetCode
- Leetcode Meeting room問題系列 - 2LeetCodeOOM
- Leetcode Meeting room問題系列 - 1LeetCodeOOM
- 【leetcode】252 會議室(陣列)LeetCode陣列
- LeetCode 252. 會議室(排序)LeetCode排序
- LeetCode-Python-252. 會議室LeetCodePython
- leetcode-區間問題總結(56,252,253,1094,435,452,646LeetCode
- Beta階段——第十週Scrum Meeting記錄Scrum
- Alpha迭代階段——第七週Scrum Meeting記錄Scrum
- 【躍遷之路】【493天】刻意練習系列252(2018.06.13)
- PostgreSQL 原始碼解讀(252)- PG 14(Improving connection scalability)#4SQL原始碼
- CF519E A and B and Lecture Rooms(樹上倍增 + 分類討論)OOM
- 最新丨CRM 整合 Meeting, 開啟新的會議體驗
- 移動VR社交新進展,Oculus讓Parties和Rooms上線GearVRVROOM
- 智慧 Request 推薦,K8s 資源利用率提升 252%K8S
- Omdia :2022年全球智慧影片監控市場規模達252億美金
- 世貿組織:2021年版世界關稅概況報告(252頁)
- 【LeetCode】如何學習LeetCode?LeetCode
- 科技愛好者週刊(第 252 期):網際網路創業變難了創業
- leetcodeLeetCode
- LeetCode in actionLeetCode
- leetcode 238LeetCode
- LeetCode 164 最大間距 HERODING的LeetCode之路LeetCode
- LeetCode 143 重排連結串列 HERODING的LeetCode之路LeetCode
- LeetCode問題LeetCode
- 【LeetCode】Jewels and StonesLeetCode