由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - Merge Intervals
相关主题
Merge Interval那道题insert interval 没必要二分吧
interval tree vs. merge intervals若问OJ的insert interval这题
问个merge interval的变体题请教Merge Intervals 和 Insert Interval空间复杂度的选择。。。。
Apple iCloud 电面问一个题目merge intervals
关于 max overlap interval 的一题这道linkedin题是不是应该用segment tree?
大家看看这几道google面试题怎么做?【新鲜出炉面试题】
问个算法题, 关于区间 overlap的FLAG面试总结
觉得G家很喜欢考interval的题,二爷要不总结一发?抛砖引玉,glassdoor上看来的zenefits题目
相关话题的讨论汇总
话题: intervals话题: merge话题: given话题: first话题: sort
进入JobHunting版参与讨论
1 (共1页)
t**********h
发帖数: 2273
1
Merge Intervals
Given a collection of intervals, merge all overlapping intervals.
For example,
Given [1,3],[2,6],[8,10],[15,18],
return [1,6],[8,10],[15,18].
大牛们,这题能O(n)么?想不出啊
l******e
发帖数: 149
2
if the collection is sorted at the first place.

【在 t**********h 的大作中提到】
: Merge Intervals
: Given a collection of intervals, merge all overlapping intervals.
: For example,
: Given [1,3],[2,6],[8,10],[15,18],
: return [1,6],[8,10],[15,18].
: 大牛们,这题能O(n)么?想不出啊

t**********h
发帖数: 2273
3
我擦,原题没说有序

【在 l******e 的大作中提到】
: if the collection is sorted at the first place.
S******6
发帖数: 55
4
先sort,O(N)可以
t**********h
发帖数: 2273
5
sort就是 nlogn了啊

【在 S******6 的大作中提到】
: 先sort,O(N)可以
b**********5
发帖数: 7881
6
那就是没有!

【在 t**********h 的大作中提到】
: sort就是 nlogn了啊
z********o
发帖数: 4284
7
if starting points end points can be sorted in o(n), then its possible.
counting sort is o(n), for example, but values need to be in a range.

【在 t**********h 的大作中提到】
: Merge Intervals
: Given a collection of intervals, merge all overlapping intervals.
: For example,
: Given [1,3],[2,6],[8,10],[15,18],
: return [1,6],[8,10],[15,18].
: 大牛们,这题能O(n)么?想不出啊

w*********m
发帖数: 4740
8
bucket sort

【在 z********o 的大作中提到】
: if starting points end points can be sorted in o(n), then its possible.
: counting sort is o(n), for example, but values need to be in a range.

p*****2
发帖数: 21240
9
(reverse (reduce (fn [a, b] (if (and (first a) (>= (last (first a)) (first b
))) (cons (assoc (first a) 1 (last b)) (rest a)) (cons b a))) () '([1,3] [2,
6] [8,10] [15,18])))
1 (共1页)
进入JobHunting版参与讨论
相关主题
抛砖引玉,glassdoor上看来的zenefits题目关于 max overlap interval 的一题
请教一道题大家看看这几道google面试题怎么做?
Given two sorted list, find the k smallest number (binary search)问个算法题, 关于区间 overlap的
求Twitter onsite 经验 (分享些它家的题目)觉得G家很喜欢考interval的题,二爷要不总结一发?
Merge Interval那道题insert interval 没必要二分吧
interval tree vs. merge intervals若问OJ的insert interval这题
问个merge interval的变体题请教Merge Intervals 和 Insert Interval空间复杂度的选择。。。。
Apple iCloud 电面问一个题目merge intervals
相关话题的讨论汇总
话题: intervals话题: merge话题: given话题: first话题: sort