![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
leetcode
JAYL_
wuwei
展开
-
合并区间
[LintCode] 156 合并区间 给出若干闭合区间,合并所有重叠的部分。 样例 样例1: 输入: [(1,3)] 输出: [(1,3)] 样例 2: 输入: [(1,3),(2,6),(8,10),(15,18)] 输出: [(1,6),(8,10),(15,18)] 挑战 O(n log n) 的时间和 O(1) 的额外空间。 /** * Definition of Interval: * public class Interval { * int start, end; *原创 2020-11-17 14:32:19 · 69 阅读 · 0 评论 -
判断是否为二分图
如果可以用两种颜色对图中的节点进行着色,并且保证相邻的节点颜色不同,那么这个图就是二分图。 785. Is Graph Bipartite? (Medium) Example 1: Input: [[1,3], [0,2], [1,3], [0,2]] Output: true Explanation: The graph looks like this: 0----1 | |...原创 2019-09-06 16:25:11 · 285 阅读 · 0 评论