由买买提看人间百态

topics

全部话题 - 话题: rect
1 2 下页 末页 (共2页)
x*********w
发帖数: 533
1
来自主题: JobHunting版 - 请教一道题:skyline
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.SortedSet;
import java.util.TreeSet;
public class EPI_15_1 {
static class Rect {
public int lft;
public int rgt;
public int height;

public Rect(int l, int r, int h) {
lft = l;
rgt = r;
height = h;
}
}

static class Point {
... 阅读全帖
p*****3
发帖数: 488
2
来自主题: Java版 - Skyline
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.SortedSet;
import java.util.TreeSet;
public class EPI_15_1 {
static class Rect {
public int lft;
public int rgt;
public int height;

public Rect(int l, int r, int h) {
lft = l;
rgt = r;
height = h;
}
}

static class Point {
... 阅读全帖
Y**G
发帖数: 1089
3
来自主题: JobHunting版 - 今早的G电面,郁闷坏了...
下面的代码我测试通过了。
public class Rect {
int x;
int y;
int width;
int height;
public Rect(int x, int y, int width, int height) {
this.x = x;
this.y = y;
this.width = width;
this.height = height;
}
public int getArea() {
return width * height;
}
Rect intersect(Rect other) {
int newX0 = Math.max(x, other.x);
int newY0 = Math.max(y, other.y);
int newX1 = Math.min(x + width, other.x + other.width);
in... 阅读全帖
a*****p
发帖数: 1285
4
来自主题: Java版 - java graphics2d 画图请教
public class MouseComponent extends JComponent {



public MouseComponent() {

shapes = new ArrayList();
lines = new ArrayList();
bounds = new ArrayList();
current = null;
startpoint = null;
endpoint = null;

isSelected = false;
eraserSelected = false;
cursorPointer = false;
isLine = false;
clear = false;
filled = false;

shapeIndex =... 阅读全帖
d*******l
发帖数: 338
5
来自主题: JobHunting版 - 尘埃落定里面的矩形题
不是很麻烦吧。
#include
#include
#include
using namespace std;
#define MP make_pair
typedef pair PII;
typedef vector VI;
struct FindVertex
{
struct rect
{
int x1, y1, x2, y2;
rect(int a, int b, int c, int d) : x1(a), y1(b), x2(c), y2(d) {}
};
vector rects;
void add(int a, int b, int c, int d)
{
rect r(a, b, c, d);
rects.push_back(r);
}
void solve()
{
int i, j;
VI v;
... 阅读全帖
F****n
发帖数: 3271
6
来自主题: JobHunting版 - 今早的G电面,郁闷坏了...
不用 line sweep 的简单解法:
import java.awt.geom.Rectangle2D;
import java.util.ArrayList;
import java.util.List;
public class Aggregation
{
protected List rects;
protected Aggregation overlap;
public Aggregation()
{
this.rects = new ArrayList<>();
this.overlap = new Aggregation();
}
public void add(Rectangle2D r)
{
List intersects = new ArrayList<>(this.rects.size());
for (Rectangle2D rect : this.rects)
{
... 阅读全帖
w****x
发帖数: 2483
7
做了一个QuadTree
struct PT
{
int x;
int y;
};
struct REC
{
POINT topLft;
POINT bottomRgt;
REC(int a, int b, int c, int d)
{
topLft.x = a;
topLft.y = b;
bottomRgt.x = c;
bottomRgt.y = d;
}
bool inRect(PT pt)
{
return pt.x >= topLft.x && pt.x <= bottomRgt.x
&& pt.y >= topLft.y && pt.y <= bottomRgt.y;
}
bool intersect(REC rect)
{
return min(bottomRgt.x, rect.bottomRgt.x) >= max(topLft.x, rect.
to... 阅读全帖
r****7
发帖数: 2282
8
刚好刷到这题。。。
greedy就可以了
typedef map > RectType;
int PilingRectsDiv2::getmax(vector X, vector Y, int limit) {
size_t sz = X.size();
RectType rects;
int result = -1;
for (size_t i = 0; i < sz; i ++) {
int h = X[i] < Y[i] ? X[i] : Y[i];
int w = X[i] < Y[i] ? Y[i] : X[i];
if (h * w < limit) {
continue;
}
if (rects.find(h) == rects.end()) {
rects[h] = vector(1, w);
} else {
rects[h].push_back(w);
}
}
RectType::it... 阅读全帖
z****e
发帖数: 54598
9
来自主题: Programming版 - android上几个常用的image处理方法
居然官方api里面没有找到
嗯,自己按照stackoverflow上的写了几个
其中一个是horizontal flip
还有一个是用最小内存消耗的方式读取图片到内存
default的8888格式吃内存太离谱了
还有就是android居然限制一个app只能16m
我插,让我想起小时候玩sfc,老板拿个磁盘一点一点读
也就只有16m
private static Map rectCache;
static {
rectCache = new HashMap();
}
public static void drawImage(Canvas canvas, Bitmap bitmap, Rect source,
Rect dest, Paint paint, boolean horizontalRotate) {
if (horizontalRotate) {
if (rectCache.get(dest) == null) {
re... 阅读全帖
l******6
发帖数: 340
10
来自主题: JobHunting版 - 问一道题
问一道题~
2D knapsack
class rect{
public:
int width;
int height;
int area;
};
input: vector source , int canvasWidth , int canvasHeight
no overlap allowed , no rotate allowed, each rect int source and be used as
many times as
possible (area = width * height , setting area as another val will be a
similar problem)
compute the max coverage of canvas using the rects int the source
a dp solution
maxCover[row][col] = max (maxCover[subRow][col] + maxCover... 阅读全帖
c********v
发帖数: 21
11
来自主题: JobHunting版 - Google onsite interview questions
请教第3题怎么做?
assume a retangle 1 to n
form a graph M[n*n], if rect i intersect with j, then M[i,j] and M[j,i]=1
othwise =0
Then get a longest path of between rect i,j
assume path[i] is the longest path ending at rect i
Is this correct?

矩形都重叠。
F****n
发帖数: 3271
12
来自主题: JobHunting版 - 今早的G电面,郁闷坏了...
有些边界条件忘了加,但这个Idea不会loop forever,
第一层Aggregation contains rects
第二层Aggregation contains intersections of rects,
第三层Aggregation contains intersections of intersections,
...
只要rects不相等,必然最后有一层没有intersection
多个Rectangle也没问题,这是一个递归迭代
s******c
发帖数: 1920
13
来自主题: Programming版 - C++构造函数的问题
为什么一下程序可以省略构造函数?什么情况下可以省略?
// friend functions
#include
using namespace std;
class CRectangle {
int width, height;
public:
void set_values (int, int);
int area () {return (width * height);}
friend CRectangle duplicate (CRectangle);
};
void CRectangle::set_values (int a, int b) {
width = a;
height = b;
}
CRectangle duplicate (CRectangle rectparam)
{
CRectangle rectres;
rectres.width = rectparam.width*2;
rectres.height = rectparam.height*2;
return (rectres)... 阅读全帖
f*******a
发帖数: 663
14
来自主题: DataSciences版 - Science上新clustering算法的分析测试
开始忘贴代码了,有朋友要求,就把修改后的代码贴在这里。改动不多,可以部分提升
效率。原来的也没删,注释掉了。供参考。
=========================================================================
clear;
close all
disp('The only input needed is a distance matrix file')
disp('The format of this file should be: ')
disp('Column 1: id of element i')
disp('Column 2: id of element j')
disp('Column 3: dist(i,j)')
if(0)
% mdist=input('name of the distance matrix file (with single quotes)?\n'
);
mdist = 'example_distances.dat';

disp('Reading input dis... 阅读全帖
S***i
发帖数: 289
15
大家的抱怨完全属实,但是不妨碍英语是first and only defacto global language,
其实从小接受英语国家正规教育的都知道一个词,etymology, 词源学,中国大学英语
都不教的,老美小学生都知道,英语3000核心词汇是日耳曼语源的,幼儿园就该掌握了
,相当于中国大学英语四级,老美大学毕业的时候,平均该掌握30000词汇,其中30%属
日耳曼语系,30%属法语系,30%属拉丁语系,在各语系里从核心词汇到派生词是有规则
的,心里有数的话,学起来很容易
比如日耳曼词right派生出righteous
对应的拉丁词根rect派生出法语词correct,rectangle, rectum等等
其实你仔细看,right和rect是一个词,只是在原始印欧语期没有拼写,待到字母发明
之后,各个部落已经彼此远离,发音也变了
来自东方的nerd们不明就里,抱着红宝书死背,应付了GRE也不会说,于是大骂英语垃
圾,实在是悲哀
S***i
发帖数: 289
16
另外英语的一个好处是,英语真正学通的人,看法语报纸,德语报纸,意大利语报纸,
西班牙语报纸,大概能猜出大意,就像中国人看日语报纸一样
再去学这些语言也容易
[在 Spivi (肥德性) 的大作中提到:]
:大家的抱怨完全属实,但是不妨碍英语是first and only defacto global language,
:其实从小接受英语国家正规教育的都知道一个词,etymology, 词源学,中国大学英语
:都不教的,老美小学生都知道,英语3000核心词汇是日耳曼语源的,幼儿园就该掌握
了,相当于中国大学英语四级,老美大学毕业的时候,平均该掌握30000词汇,其中30%
属日耳曼语系,30%属法语系,30%属拉丁语系,在各语系里从核心词汇到派生词是有规
则的,心里有数的话,学起来很容易
:比如日耳曼词right派生出righteous
:对应的拉丁词根rect派生出法语词correct,rectangle, rectum等等
:其实你仔细看,right和rect是一个词,只是在原始印欧语期没有拼写,待到字母发明
:之后,各个部落已经彼此远离,发音也变了
:来自东方的nerd们不明就... 阅读全帖
w********2
发帖数: 632
17
来自主题: Military版 - gmo食品最大的问题
HGT involving prokaryotes
Many studies support the significant role of HGT in the evolution of
prokaryotes (Gogarten et al., 2002; Jain et al., 2003; Kunin and Ouzounis,
2003). The principle sources of novel genes are provided by other prokary-
otes, viruses and MGEs (Fig. 1). In particular, plasmids and composite
mobile elements contribute significantly to HGT between prokaryotes. In some
cases, composite elements and megaplasmids are composed of more than 100
genes (Bentley et al., 2002; Hacke... 阅读全帖
g*******y
发帖数: 1930
18
来自主题: JobHunting版 - Google interview question
他的思想就是从每个1出发,往四个方向走,每走过一个格子0,在该格子留下一个印记
,直到碰见一个格子1就停止。
这样,一个格子0如果上下左右都被格子1包围的话,那么格子1应该有4个印记
然后过滤一遍,只留下所有有4个印记的格子,然后找一个最大的rect/sq就容易了(其
实就是若干个isolated图形,找rect/square)
D*********y
发帖数: 876
19
来自主题: JobHunting版 - 请问一道面试题
先把x方向左右两条边都sort一下,O(nlgn)
然后用以下的判断:
bool overlap(Rect a, Rect b) {
return ( a.ul.x <= b.lr.x &&
a.ul.y >= b.lr.y &&
a.lr.x >= b.ul.x &&
a.lr.y <= b.ul.y );
}
其中ul是upper left,lr是lower right
找满足a.ul.x <= b.lr.x和a.lr.x >= b.ul.x的
然后把满足条件的矩形的y方向两条边,加上要比较的矩形本身,sort一下
找到满足a.ul.y >= b.lr.y和a.lr.y <= b.ul.y
r*g
发帖数: 186
20
来自主题: JobHunting版 - 今早的G电面,郁闷坏了...
我记得以前有个关于rect的
是对x排序
然后另取一个set存储rect
第一次见到x的就加入
第二次见到的就删除啥的
不知道能不能adapt到这里
Y***r
发帖数: 15270
21
来自主题: LosAngeles版 - irvine 怎么发音
这例子太多了,基本就是英国英语和美国英语的区别
direct可以读"低rect"也可以读成"带rect"
m*******0
发帖数: 25
22
New! Nile Motion Coffee Table - $350 (fremont)
http://www.amazon.com/Beverly-Hills-Furniture-Nile-Rect-CT-Moti
Nile Rect CT Features: -Smooth ball-bearing release mechanism for easy one-
handed operation.-Checkered veneer top.-Represents the convergence of style,
quality and functionality.-Interior storage space is fully veneered,
allowing for years of regular use. Construction: -Construction: Wood veneer
on medium density fiberboard. Color/Finish: -Wenge finish. Dimensions: -
Dimensions: 13'' H... 阅读全帖
d*****0
发帖数: 68029
23
【 以下文字转载自 Apple 讨论区 】
发信人: bullmaster (master), 信区: Apple
标 题: 被隔壁ablution那个傻叉封了,在这里说说圆角矩形
发信站: BBS 未名空间站 (Sat Feb 16 13:12:06 2013, 美东)
Fuck,圆角矩形是Apple Design, and there is a history for that.
圆角矩形要追溯到30年前的Apple Lisa,Steve Jobs坚持苹果图形界面上的矩形必须是
圆角而不是尖角。 Steve wanted Apple computer to model objects in reality,so
people will not be afraid of computers.
但当时的硬件条件下在屏幕上画圆是件很慢的事情,因为要计算平方。 Apple
engineer Bill Atkinson 发明了只用相邻奇数之和算平方的算法,比如1+3=4, 1+3+5=
9, etc. 所以当时只有苹果的电脑才可以在屏幕上快速画圆弧。 圆角矩形就好像6色
的彩色苹果标志... 阅读全帖
d********u
发帖数: 5383
24
【 以下文字转载自 Apple 讨论区 】
发信人: bullmaster (master), 信区: Apple
标 题: 被隔壁ablution那个傻叉封了,在这里说说圆角矩形
发信站: BBS 未名空间站 (Sat Feb 16 13:12:06 2013, 美东)
Fuck,圆角矩形是Apple Design, and there is a history for that.
圆角矩形要追溯到30年前的Apple Lisa,Steve Jobs坚持苹果图形界面上的矩形必须是
圆角而不是尖角。 Steve wanted Apple computer to model objects in reality,so
people will not be afraid of computers.
但当时的硬件条件下在屏幕上画圆是件很慢的事情,因为要计算平方。 Apple
engineer Bill Atkinson 发明了只用相邻奇数之和算平方的算法,比如1+3=4, 1+3+5=
9, etc. 所以当时只有苹果的电脑才可以在屏幕上快速画圆弧。 圆角矩形就好像6色
的彩色苹果标志... 阅读全帖
w********2
发帖数: 16371
25
来自主题: Apple版 - 在这里说说圆角矩形 (转载)
发现bullmaster的原帖被删除了,正好有备份,再转过来。原来标题里的一些字删除了。
【 以下文字转载自 Apple_II 俱乐部 】
发信人: wavelets02 (波士顿), 信区: Apple_II
标 题: 被隔壁ablution那个傻叉封了,在这里说说圆角矩形 (转载)
发信站: BBS 未名空间站 (Sat Feb 16 13:48:28 2013, 美东)
【 以下文字转载自 Apple 讨论区 】
发信人: bullmaster (master), 信区: Apple
标 题: 被隔壁ablution那个傻叉封了,在这里说说圆角矩形
发信站: BBS 未名空间站 (Sat Feb 16 13:12:06 2013, 美东)
Fuck,圆角矩形是Apple Design, and there is a history for that.
圆角矩形要追溯到30年前的Apple Lisa,Steve Jobs坚持苹果图形界面上的矩形必须是
圆角而不是尖角。 Steve wanted Apple computer to model objects in reality... 阅读全帖
k****y
发帖数: 781
26
来自主题: Programming版 - 继承的assignment operator问题
void Textbox :: operator = (TextBox &source) {
if (this==&source) return;

Rect:: operator = (source );
textColor = source.textcolor;

}
Rect:: operator = (source );这句的含义,难道不要写成 a=b的形式?
k****y
发帖数: 781
27
来自主题: Programming版 - 继承的assignment operator问题
是不是应该写成
*(Rect*)this = *(Rect*)&source;
r*******y
发帖数: 1729
28
来自主题: _K12版 - 快,你们数学好的
sinc是rect的福利叶变换把。我记得sech^2好像听接近rect的。
v******t
发帖数: 3404
29
来自主题: Military版 - 韩国将炮轰大青岛
错误
您所请求的网址(URL)无法获取
当尝试读取以下网址(URL)时: http://img13.tianya.cn/Photo/2010/11/24/319244
24_14249464.jpg
发生了下列的错误:
* Access Denied.
拒绝访问
Access control configuration prevents your request from being allowed
at this time. Please contact your service provider if you feel this is incor
rect.
当前的存取控制设定禁止您的请求被接受,如果您觉得这是错误的,请与您网路
服务的提供者联系。
本缓存服务器管理员:webmaster
可能不支持直接看图吧。
S*****s
发帖数: 7520
30
来自主题: Military版 - 美帝的大学生苦啊
http://finance.yahoo.com/news/9-unbelievable-student-loan-horro
512874.html
这钱哈时候还完啊
With the cost of college continuing to rise and the economy still stagnating
, the student debt burden has swollen to a record $1 trillion.
Mark Kantrowitz, publisher of Fastweb.com and FinAid.org, believes that one
of the main culprits behind the student debt crisis is the private student l
oan sector.
"Students are following their dreams and don't pay attention to their debt,"
Kantrowitz says. "They sign whate... 阅读全帖
C********1
发帖数: 5281
31
https://www.zillow.com/homes/for_sale/Princeton-NJ/114428386_zpid/395489_rid
/2000-_lot/globalrelevanceex_sort/40.352038,-74.627467,40.324495,-74.687806_
rect/13_zm/
好比这个房,才45.5万刀,10分小学,好学区的安全应该问题不大。

发帖数: 1
32
http://thejns.org/doi/pdf/10.3171/2016.8.PEDS16321
外国人的无耻 有时候远远超过我们的想象。 这个叫Tuite的老美医生在未告知肖医生
的前提下,把肖拉过来做双盲实验。肖在指导了两例后才被告知,原来是被人在做套。
更无耻的是,该老美事后发表的那篇“著名的”文章“Lack of ef cacy of an
intradural somatic-to- autonomic nerve anastomosis (Xiao procedure) for
bladder control in children with myelomeningocele and lipomyelo- meningocele
,该实验是肖参与的。绝了,你还真挑不出来他说谎的理儿
First, regarding my involvement in the trial, Dr. Tu- ite’s team traveled
to China in 2009 and personally ex- amined more than a dozen children wi... 阅读全帖
s*****V
发帖数: 21731
33
来自主题: Military版 - 大刘的演讲写得真好
高速计算机可以把已有的东西整合得更精准,可以把宇航员照顾得更舒适。
HEROTIC MISSION TO MARS
https://fsmedia.imgix.net/b0/b3/90/a1/6e49/464f/80d6/3990f6eff3c6/a-mars-
city.png?rect=0%2C22%2C1280%2C640&dpr=2&auto=format%2Ccompress&w=650
w********2
发帖数: 632
34
来自主题: Military版 - gmo食品最大的问题
Inconsistent evolutionary scenarios
Deriving a parsimonious evolutionary scenario is based on the premise that
over time, genetic change is relent- less, such that distant relatives are
expected to have fewer features in common than close relatives (Koonin et al
., 2001). Therefore, the presence of some distinguishing ge- netic signal in
a distant relative but absent from more closely related organisms
contradicts this expectation. The most common causes of these anomalies are
loss of the geneti... 阅读全帖
t*******e
发帖数: 2113
35
来自主题: QueerNews版 - 丹佛蛋糕店的歧视官司

http://www.colorado.gov/cs/Satellite?
blobcol=urldata&blobheadername1=Content-
Disposition&blobheadername2=Content-
Type&blobheadervalue1=inline%3B+filename%3D%22Colorado+Anti-
Discrimination+Act+statutes+-
+unofficial.pdf%22&blobheadervalue2=application%2Fpdf&blobkey=id&blobtab
le=MungoBlobs&blobwhere=1251818317123&ssbinary=true
你可以搜搜 CADA 24-34-601
24-34-601. Discrimination in
places of public accommodation
(1) As used in this part 6, “place of public accommodation”
means any place of busines... 阅读全帖
B*V
发帖数: 3365
36
来自主题: RisingChina版 - 美帝的大学生苦啊
http://finance.yahoo.com/news/9-unbelievable-student-loan-horro
512874.html
这钱哈时候还完啊
With the cost of college continuing to rise and the economy still stagnating
, the student debt burden has swollen to a record $1 trillion.
Mark Kantrowitz, publisher of Fastweb.com and FinAid.org, believes that one
of the main culprits behind the student debt crisis is the private student l
oan sector.
"Students are following their dreams and don't pay attention to their debt,"
Kantrowitz says. "They sign whate... 阅读全帖
s****7
发帖数: 2507
37
The first state law mandating vaccination was enacted in Massachusetts
in 1809; in 1855, Massachusetts became the first state to enact a
school vaccination re-quirement. The constitutional basis of vaccination
requirements rests in the po-lice power of the state. Nearly 100 years ago,
the U.S. Supreme Court issued its landmark ruling in Jacobson v.
Massachusetts, upholding the right of states to compel vaccination. The
Court held that a health regulation requiring small- pox vaccinat... 阅读全帖
s****7
发帖数: 2507
38
The Court held that a health regulation requiring small- pox vaccination was
a reasonable exercise of the state’s police power that did not violate the
liberty rights of individuals under the Fourteenth Amendment to the U.S.
Constitution. The police power is the authority reserved to the states by
the Constitution and embraces “such reasonable regulations established di-
rectly by legislative enactment as will protect the public health and the
public safety”
the Court spe-cifically rejecte... 阅读全帖
g******t
发帖数: 18158
39
来自主题: USANews版 - 川粉的精神领袖不蠢
https://compote.slate.com/images/1f09ad65-0065-43e3-9bd4-2ba7eaddc457.jpeg?
width=780&height=520&rect=3000x2000&offset=0x0
这孙子混的不错啊,混上给长公主拎包了,一次拎两个包,一个大包,一个小包
l********t
发帖数: 878
40
来自主题: ebiz版 - MLGB多事的人真多啊
Date: 2010-04-09, 12:18PM PDT
Reply to: see below
Don't buy overpriced iPads from jerks on Craigslist!!!
There are still plenty available at the apple store. Please don't encourage
people to buy iPads on spec and sell them for more than they're worth. Folks
who do that are jerks, and they don't deserve to make a profit on the incor
rect notion that iPads are scarce when there are plenty still readily availa
ble from legitimate vendors.
Location:
it's NOT ok to contact this poster with services o
b**j
发帖数: 20742
41
来自主题: ebiz版 - greendot的问题
看网上说每个月direct deposit $1000可以免月费,direct deposit也不收费。如何di
rect deposit啊?说是要paycheck? 直接银行账户能转账算direct transfer吗?
f****y
发帖数: 737
42
请大家想一想,英语是谁发明的?英国人呗!
英国人认不认识汉语?不认识!
那么英国人在学英语单词的时候需不需要记住单词的汉语意思?不需要,英国人的英语
课本里根本就没有汉字,何谈记住单词的汉语意思?
那么既然英国人学英语不需要记住(甚至根本就见不到)单词的汉语意思,那么中国人学
英语为什么要去记住单词的汉语意思呢?这种做法大家不觉得奇怪吗?
然而由于中国人学英语时都在背单词的汉语意思,因此大家反而觉不出“背汉字”有什
么奇怪的了。
其实仔细想一想,这个行为真的很奇怪,奇怪的根源不在于行为本身,而在于中国人普
遍不会直接识别英语单词的意思,因而只好靠汉语符号来机械地帮助记忆英语单词的意
思,这样去学英语不仅多此一举,而且必然会陷入苦海无边的符号记忆灾难中。
其实英语单词和汉字一样,存在着很多的“偏旁部首”,知道了偏旁部首你就可以根据
它们直接来猜测单词的意思,虽不说百分之百猜准,但起码可以猜测个大概,至少在别
人告诉过你单词的意思后你可以恍然大悟地领会它,这样就可以大大增强你对英语单词
“见字识意”的能力,做到真正认识一个单词,而把它的汉语意思仅做为一般参考。
举几个例子来说吧:
比如单词... 阅读全帖
g*******y
发帖数: 1930
43
来自主题: JobHunting版 - 问一个题
这个题其实以前讨论过的。
square有简单的DP解O(N^2)
rect的话,我当时见人贴了code,不过我当时没细心读不知道对不对,因为那时我自己
还没做出来O(N^2)的解。
z*j
发帖数: 42
44
来自主题: JobHunting版 - Google的电话面试题
just some naive code:
int left, right;
int rectArea;
for(int i = 0; i < size; i++)
{
//for each Histo[i] as the lowest rect, we find left and right >=
Histo[i]
//check left
for(left = i; left >=0; left--)
{
if(Histo[left] < Histo[i])
break;
}
left++;
//check right
for(right = i; right < size; right++)
{
if(Histo[right] < Histo[i])
break;
}
f****n
发帖数: 208
45
来自主题: JobHunting版 - Google onsite interview questions
If you model this way, the answer is not the longest path, but the shape.
Since it wants the rectangles that all overlapping. In the following setup,
the answer is (1, 2, 5)
The longest path is 3,1,2,4,5
Rect ID (Overlap with ID)
1 (2, 3, 5)
2 (1, 4, 5)
3 (1)
4 (2, 5)
5 (1, 2, 4)
D***h
发帖数: 183
46
来自主题: JobHunting版 - O(NlogN) largest rectangle in histogram
显然是错的.
横跨两边的最大Rect高度可能比最中间那个小。
g*********s
发帖数: 1782
47
来自主题: JobHunting版 - next larger element in unsorted array
good observation to associate it with max rect in hist.
g**e
发帖数: 6127
48
来自主题: JobHunting版 - TPM position available @ Amazon
Please let me know if you are interested. I can forward your resume to HM di
rectly.
This position is in Seattle, WA. It's an experienced hire (level 6).
Job Description
Amazon's Global Retail Catalog Tools team is responsible for developing inno
vative and user-friendly applications to help retail business owners to mana
ge the worldwide retail catalog. Our large scale web applications running o
n distributed systems have direct and critical business impact. We are look
ing for an experienced... 阅读全帖
a*****n
发帖数: 158
49
来自主题: JobHunting版 - 问两个C++的问题
1.内存会泄漏,,尽量不要再constructor里面做内存分配的东东,,要么用初始化函
数,或者是SMART POINTER。
2.其实应该谁也别继承,因为没有办法ENFORCE SQUARE,如果非要的话,,应该是
SQUARE inherit RECT吧。。。
j**********3
发帖数: 3211
50
来自主题: JobHunting版 - 问个问题
linkedlist 不用buffer,这是哪跟哪阿。。。
maximum rect 我去年做过1次再没做第2次,太恶心了,如果面试遇到,只能说我自己
运气太差。

2)
1 2 下页 末页 (共2页)