Leetcode 252 Meeting Rooms
2016-01-29 05:11
369 查看
Given an array of meeting time intervals consisting of start and end times
ei), determine if a person could attend all meetings.
For example,
Given
return
Understand the problem:
The problem looks very similar to the merge interval and insert intervals. So the idea is still the same: first sort the intervals according to the start times, then check if there is any overlap.
所以正确的解法是将intervals中所有的interval都按start time进行排序,然后判断是否有overlap,如果有overlap就返回false,否则返回true。
The idea is from here
http://buttercola.blogspot.com/2015/08/leetcode-meeting-rooms.html
[[s1,e1],[s2,e2],...](si <
ei), determine if a person could attend all meetings.
For example,
Given
[[0, 30],[5, 10],[15, 20]],
return
false.
Understand the problem:
The problem looks very similar to the merge interval and insert intervals. So the idea is still the same: first sort the intervals according to the start times, then check if there is any overlap.
所以正确的解法是将intervals中所有的interval都按start time进行排序,然后判断是否有overlap,如果有overlap就返回false,否则返回true。
The idea is from here
http://buttercola.blogspot.com/2015/08/leetcode-meeting-rooms.html
相关文章推荐
- hdu 1806 RMQ
- hdu 1806 RMQ
- myeclipse 常规web项目创建
- Balanced Binary Tree -- LeetCode
- xfire客户端调用cxf服务端,一直报错
- how to get current path in qt
- 【Leetcode】Copy List with Random Pointer
- ASP.Net中无刷新执行Session身份验证
- LeetCode_40 Combination Sum II
- MSB&LSB与Endianness
- LeetCode_39 Combination Sum
- jquery插件理解看这
- LeetCode_37 Sudoku Solver
- how to add external library in qt under ubuntu
- Group Anagrams -- LeetCode
- 字符串转化为十六进制
- 音乐播放器中的跳动的平衡器
- squeeze函数编写
- openstack运维实战系列(十八)nova与ceph结合
- Java 如何将字符串信息直接写保存到文本文件