Redian新闻
>
VB Estimation by end of FY2013
avatar
VB Estimation by end of FY2013# EB23 - 劳工卡
j*y
1
detect if a sorted array contains two integer that sum up to 7. And then
improve your code so that the array is accessed with only one iteration
any solution for one iteration?
avatar
d*n
2
ok, Open Gate or CIR is not included in this estimation
1. by end of FY2013, if SO<20000
EB2c --> 9/15/2008
2. if SO = 25000
EB2c --> 1/1/2009
avatar
g*e
3
use hashset to store every item, for each a[i] check if set.Contains(7-a[i])
one pass, O(n) space

【在 j**y 的大作中提到】
: detect if a sorted array contains two integer that sum up to 7. And then
: improve your code so that the array is accessed with only one iteration
: any solution for one iteration?

avatar
f*8
4
不会有任何spill over到中国.
2008年9月15日的估计太过乐观。能到7月15日就很不错了。
烙印还指望着从我们EB2这里要spill over呢:
http://www.trackitt.com/usa-discussion-forums/i485-eb/117128112

【在 d****n 的大作中提到】
: ok, Open Gate or CIR is not included in this estimation
: 1. by end of FY2013, if SO<20000
: EB2c --> 9/15/2008
: 2. if SO = 25000
: EB2c --> 1/1/2009

avatar
i*e
5
Or a better way without using extra space is to use two pointers to traverse
the list. One from the start, the other from the end.
一些常见面试题的答案与总结 -
http://www.ihas1337code.com
avatar
d*n
6
7/31/2008 is the lower limit of my estimation based on 3500 for eb2c in
fy2013
avatar
j*y
7
that would be two iteration?

a[i])

【在 g**e 的大作中提到】
: use hashset to store every item, for each a[i] check if set.Contains(7-a[i])
: one pass, O(n) space

avatar
H*E
8
AGREE WITH THIS ONE..
based on demand data, EB2C demand in 2008 is ~ 3.4k; if we only have 2.8k
per year, the OP's prediction seems tooooo optimistic..

【在 f*******8 的大作中提到】
: 不会有任何spill over到中国.
: 2008年9月15日的估计太过乐观。能到7月15日就很不错了。
: 烙印还指望着从我们EB2这里要spill over呢:
: http://www.trackitt.com/usa-discussion-forums/i485-eb/117128112

avatar
j*y
9
a bit unsure that would be one iteration as required.

traverse

【在 i**********e 的大作中提到】
: Or a better way without using extra space is to use two pointers to traverse
: the list. One from the start, the other from the end.
: 一些常见面试题的答案与总结 -
: http://www.ihas1337code.com

avatar
a*x
10


【在 d****n 的大作中提到】
: ok, Open Gate or CIR is not included in this estimation
: 1. by end of FY2013, if SO<20000
: EB2c --> 9/15/2008
: 2. if SO = 25000
: EB2c --> 1/1/2009

avatar
c*1
11
array如果是sorted 保持两个指针 一个头一个尾往中间移动就行了
为什么不是one iteration as required?
avatar
b*i
12
不要啊。。。。。。。。

【在 a***x 的大作中提到】
: 噗
avatar
g*e
13
it's one iteration.
I didn't noticed it's a sorted array, so use head & tail pointers and scan
forward/backward. it's better.

【在 j**y 的大作中提到】
: that would be two iteration?
:
: a[i])

avatar
D*g
14
上辈子是豌豆炮的。。伤不起啊。。

【在 a***x 的大作中提到】
: 噗
avatar
j*y
15
sorry 我以为是
for(from begin){
for(from end){
}
}
没想明白你怎么做,详细点?多谢

【在 c********1 的大作中提到】
: array如果是sorted 保持两个指针 一个头一个尾往中间移动就行了
: 为什么不是one iteration as required?

avatar
i*e
16
你先写出 7 的 two sum:
ie,
...
1+6
2+5
3+4
想想 怎么用排好序的特性来解决这题?
一些常见面试题的答案与总结 -
http://www.ihas1337code.com
avatar
g*f
17
刚写了一下,应该work。
O(1) space, O(n) time.
bool SumToS(int* array, const int len, const int S,
unsigned& ndx1, unsigned& ndx2)
{
int i = 0, j = len-1;
while (i != j) {
if (array[i] + array[j] < S) ++i;
else if (array[i] + array[j] > S) --j;
else {ndx1 = i; ndx2 = j; return true;}
}
return false;
}
avatar
s*y
18
The array should not be sorted.
Is it?

【在 g**f 的大作中提到】
: 刚写了一下,应该work。
: O(1) space, O(n) time.
: bool SumToS(int* array, const int len, const int S,
: unsigned& ndx1, unsigned& ndx2)
: {
: int i = 0, j = len-1;
: while (i != j) {
: if (array[i] + array[j] < S) ++i;
: else if (array[i] + array[j] > S) --j;
: else {ndx1 = i; ndx2 = j; return true;}

avatar
g*f
19
It is sorted.

【在 s*****y 的大作中提到】
: The array should not be sorted.
: Is it?

avatar
j*y
20
明白 多谢

【在 i**********e 的大作中提到】
: 你先写出 7 的 two sum:
: ie,
: ...
: 1+6
: 2+5
: 3+4
: 想想 怎么用排好序的特性来解决这题?
: 一些常见面试题的答案与总结 -
: http://www.ihas1337code.com

avatar
j*y
21
嗯 和我想的差不多 谢了

【在 g**f 的大作中提到】
: 刚写了一下,应该work。
: O(1) space, O(n) time.
: bool SumToS(int* array, const int len, const int S,
: unsigned& ndx1, unsigned& ndx2)
: {
: int i = 0, j = len-1;
: while (i != j) {
: if (array[i] + array[j] < S) ++i;
: else if (array[i] + array[j] > S) --j;
: else {ndx1 = i; ndx2 = j; return true;}

avatar
b*8
22
既然排序了,当然不用哈希了。能不用哈希就不用哈希,有些面试的不喜欢哈希,因为
哈希实际效果不一定好。BST是肯定有保证的。
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。