Redian新闻
>
OQO,你被版上的某个大哥级人物批了
avatar
OQO,你被版上的某个大哥级人物批了# Immigration - 落地生根
l*v
1
Given two arrays A & B of length l, containing non negative integers, such
that the sum of integers in A is the same as sum of integers in B.( The
numbers need not be the same in both the arrays.)
Now if you start with an index 'k' in each array and do the following
summation, SUMMATION (Ak-Bk), where Ak is the value at index k of array A,
and Bk is the value at index k of array B, where 'k' increments and wraps
back all the way to k-1, the final sum value will be zero.
Question: Find a suitable 'k' such that during any point in the summation,
SUMMATION(Ak-Bk) is always non negative. Find such a 'k' in O(n) time.
http://www.careercup.com/question?id=6360675
第二段
where Ak is the value at index k of array A, and Bk is the value at index k
of array B, where 'k' increments and wraps back all the way to k-1, the
final sum value will be zero.
这是什么意思啊?
avatar
L*S
2
两个版主伪币都是好几万,怎么搞这么多的?
avatar
s*p
3
*__*
赶快去考律师执照吧,多点公信力!hehe
avatar
f*5
4
consider the array as a cycle,
expect
a[k]-b[k] >=0
a[k]-b[k] + a[k+1]-b[k+1] >=0
...
a[k]-b[k] + a[k+1]-b[k+1] +...+ a[n-1]-b[n-1] >=0
a[k]-b[k] + a[k+1]-b[k+1] +...+ a[n-1]-b[n-1] +a[0]-b[0] >=0
...
a[k]-b[k] + a[k+1]-b[k+1] +...+ a[n-1]-b[n-1] +a[0]-b[0] +... a[k-
1]+b[k-1] =0

such
The
array A,
wraps
summation,

【在 l*****v 的大作中提到】
: Given two arrays A & B of length l, containing non negative integers, such
: that the sum of integers in A is the same as sum of integers in B.( The
: numbers need not be the same in both the arrays.)
: Now if you start with an index 'k' in each array and do the following
: summation, SUMMATION (Ak-Bk), where Ak is the value at index k of array A,
: and Bk is the value at index k of array B, where 'k' increments and wraps
: back all the way to k-1, the final sum value will be zero.
: Question: Find a suitable 'k' such that during any point in the summation,
: SUMMATION(Ak-Bk) is always non negative. Find such a 'k' in O(n) time.
: http://www.careercup.com/question?id=6360675

avatar
p*t
5
斑竹有工资啊,长期不花就有那么多了,我就搞了个斑竹当当,现在伪币慢慢又开始有
了。

【在 L*S 的大作中提到】
: 两个版主伪币都是好几万,怎么搞这么多的?
avatar
l*v
6
谢谢,现在理解了。就是以前很流行的加油站的题目

【在 f*********5 的大作中提到】
: consider the array as a cycle,
: expect
: a[k]-b[k] >=0
: a[k]-b[k] + a[k+1]-b[k+1] >=0
: ...
: a[k]-b[k] + a[k+1]-b[k+1] +...+ a[n-1]-b[n-1] >=0
: a[k]-b[k] + a[k+1]-b[k+1] +...+ a[n-1]-b[n-1] +a[0]-b[0] >=0
: ...
: a[k]-b[k] + a[k+1]-b[k+1] +...+ a[n-1]-b[n-1] +a[0]-b[0] +... a[k-
: 1]+b[k-1] =0

avatar
f*5
7
en
u r right
in fact,i am also confused with his description for the first time
i read it

【在 l*****v 的大作中提到】
: 谢谢,现在理解了。就是以前很流行的加油站的题目
avatar
a*k
8
What's 加油站的题目? any link?
Thanks,

【在 l*****v 的大作中提到】
: 谢谢,现在理解了。就是以前很流行的加油站的题目
avatar
P*i
10
solution是从maxsum subsequence的第一个开始?

【在 l*****v 的大作中提到】
: 谢谢,现在理解了。就是以前很流行的加油站的题目
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。