Redian新闻
>
那种记忆床垫好不好?
avatar
那种记忆床垫好不好?# Living
l*i
1
Given n non-negative integers a1, a2, ..., an, where each represents a point
at coordinate (i, ai). n vertical lines are drawn such that the two
endpoints of line i is at (i, ai) and (i, 0). Find two lines, which together
with x-axis forms a container, such that the container contains the most
water.
Anyone explain the testcase [1,2,4,3], it seems to me that the answer is 6
for this case.
the bar between h=1 and h=2 can trap 1*1 = 1 unit of water
the bar between h=2 and h=4 can trap 2*1 = 2 unit of water
the bar between h=4 and h=3 can trap 3*1 = 3 unit of water
add up to 1 + 2 + 3 = 6.
Did I miss something?
avatar
t*y
2
RT, 记得很久以前好像有人说请问用DISCOVER IT 买WALMART的GIFT CARD 给6%, 现在
还可以吗?
如果可以,应该怎么买啊,网上买怎么才能拿到GIFT CARD 啊?
谢谢
avatar
k*n
3
据说很舒服。。。
但难道不是太软了嘛?
有没有睡过的同学
avatar
b*e
4
You can use only one container here: the one defined by the left-most bar
and the right-most bar that you choose to form the container. You used
multiple containers in your calculation.

point
together

【在 l***i 的大作中提到】
: Given n non-negative integers a1, a2, ..., an, where each represents a point
: at coordinate (i, ai). n vertical lines are drawn such that the two
: endpoints of line i is at (i, ai) and (i, 0). Find two lines, which together
: with x-axis forms a container, such that the container contains the most
: water.
: Anyone explain the testcase [1,2,4,3], it seems to me that the answer is 6
: for this case.
: the bar between h=1 and h=2 can trap 1*1 = 1 unit of water
: the bar between h=2 and h=4 can trap 2*1 = 2 unit of water
: the bar between h=4 and h=3 can trap 3*1 = 3 unit of water

avatar
t*y
5
zijidingggggggggggggg
avatar
G*h
6
偶是在硬板床上铺那个
还可以,表面软,底下硬
其实躺下了还碰不到底

【在 k**n 的大作中提到】
: 据说很舒服。。。
: 但难道不是太软了嘛?
: 有没有睡过的同学

avatar
l*i
7
Thanks, that explains it.
avatar
t*y
8
???
avatar
H*a
9
我觉得不是很好用

【在 k**n 的大作中提到】
: 据说很舒服。。。
: 但难道不是太软了嘛?
: 有没有睡过的同学

avatar
c*9
10
话说Largest Rectangle in Histogram这道题除去stack的o(n)方法,可否用这道题
的两边夹做呢?
avatar
y*i
11
有说法,这种床垫挥发出的气体毒性挺大。
avatar
c*9
12
仔细想了下,不能。。因为需要考虑内部的情况

【在 c****9 的大作中提到】
: 话说Largest Rectangle in Histogram这道题除去stack的o(n)方法,可否用这道题
: 的两边夹做呢?

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。