由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - 这题咋做?
相关主题
微软校园面试总结请问一道面试题
找最近的点,这题咋解?请教一个Axis-Aligned Rectangles的算法
请教一道google的数组遍历题问道G题(2)
Smallest Rectangle Enclosing Black Pixels怎么求contour of overlapping rectangles
O(NlogN) largest rectangle in histogram面试遇到扫描线算法和interval tree 问题怎么办
求overlap的rectagales问个算法题, 关于区间 overlap的
问一道flg面试题老问题了,网上竟然找不到答案
请教大家一道Google的题目google面试问题
相关话题的讨论汇总
话题: cards话题: table话题: area话题: card
进入JobHunting版参与讨论
1 (共1页)
l*****a
发帖数: 14598
1
deck of cards
put them randomly on the table.
two cards can only overlap with rectangle area.(cards must be Vertical/
horizontal to the edge of the table)
find the total area covered by those cards
v***a
发帖数: 365
2
Given, cards with (X_S1, X_E1, Y_S1, Y_E1)
1) Discretization on all points O(N)
O(N)
2) Sort by X
O(N)
3) Cut into pieces using sorted X.
O(N)
4) Count each piece separately.
O(N)
5) Sum up all
Total O(N)
e***l
发帖数: 710
3
area(Table) - sum_i (area(Card i)) + sum_{i,j>i} Overlap(Card i, Card j)
C*********h
发帖数: 74
4
2楼对,3楼错。

【在 l*****a 的大作中提到】
: deck of cards
: put them randomly on the table.
: two cards can only overlap with rectangle area.(cards must be Vertical/
: horizontal to the edge of the table)
: find the total area covered by those cards

b******e
发帖数: 52
5
O(NlgN)
m******s
发帖数: 165
6
segment tree, O(nlogn)

【在 l*****a 的大作中提到】
: deck of cards
: put them randomly on the table.
: two cards can only overlap with rectangle area.(cards must be Vertical/
: horizontal to the edge of the table)
: find the total area covered by those cards

H***e
发帖数: 476
7
没看懂。什么叫discretization on all points?

【在 v***a 的大作中提到】
: Given, cards with (X_S1, X_E1, Y_S1, Y_E1)
: 1) Discretization on all points O(N)
: O(N)
: 2) Sort by X
: O(N)
: 3) Cut into pieces using sorted X.
: O(N)
: 4) Count each piece separately.
: O(N)
: 5) Sum up all

a********m
发帖数: 15480
8
不可能O(n)吧。

【在 C*********h 的大作中提到】
: 2楼对,3楼错。
H***e
发帖数: 476
9
这题谁能给个确切的解法么?似乎是经典题?

【在 l*****a 的大作中提到】
: deck of cards
: put them randomly on the table.
: two cards can only overlap with rectangle area.(cards must be Vertical/
: horizontal to the edge of the table)
: find the total area covered by those cards

z******t
发帖数: 59
10
既然有sort,怎么能是O(N)?

【在 v***a 的大作中提到】
: Given, cards with (X_S1, X_E1, Y_S1, Y_E1)
: 1) Discretization on all points O(N)
: O(N)
: 2) Sort by X
: O(N)
: 3) Cut into pieces using sorted X.
: O(N)
: 4) Count each piece separately.
: O(N)
: 5) Sum up all

z******t
发帖数: 59
11
Share a blog about this issue:
http://codercareer.blogspot.com/2011/12/no-27-area-of-rectangle
It has detailed analysis and solution there.
1 (共1页)
进入JobHunting版参与讨论
相关主题
google面试问题O(NlogN) largest rectangle in histogram
一个特别的inplace merge two sorted arrays求overlap的rectagales
问个简单的GooG题目问一道flg面试题
问两道微软题请教大家一道Google的题目
微软校园面试总结请问一道面试题
找最近的点,这题咋解?请教一个Axis-Aligned Rectangles的算法
请教一道google的数组遍历题问道G题(2)
Smallest Rectangle Enclosing Black Pixels怎么求contour of overlapping rectangles
相关话题的讨论汇总
话题: cards话题: table话题: area话题: card