Redian新闻
>
usbank 的dd要求严吗?
avatar
usbank 的dd要求严吗?# Money - 海外理财
g*0
1
Find the largest possible difference in an array of integers, such that the
smaller integer occurs earlier in the array。
请大虾指点。
avatar
d*i
2
开户bonus要求dd,谢谢啦
avatar
g*e
3
这题前两天刚讨论过了,往前翻翻

the

【在 g******0 的大作中提到】
: Find the largest possible difference in an array of integers, such that the
: smaller integer occurs earlier in the array。
: 请大虾指点。

avatar
r*y
5
same as finding the subarray of max sum

the

【在 g******0 的大作中提到】
: Find the largest possible difference in an array of integers, such that the
: smaller integer occurs earlier in the array。
: 请大虾指点。

avatar
g*0
7
Yes, got it. Thank you all!
avatar
g*e
8
不太一样,但是思路几乎一样,找到两个序列,一个从a[0]开始递减,一个从a[n]开始
递增。要求的两个点必定在这个两个序列里。

【在 g******0 的大作中提到】
: 你说的是这题吧,好像不一样。
: http://www.mitbbs.com/article/JobHunting/31875095_0.html

avatar
t*8
10
从这学习了不少。小小贡献一下,希望是对的:).
#!/usr/bin/python
a=[1.25,1.75,2.86,1.1,3.45,5.00,6.78,3.75]
max_diff = 0
min_v = a[0]
min_i = 0
index_pair=()
i = 1
while i < len(a):
if a[i] - min_v > max_diff:
index_pair = (min_i, i)
max_diff = a[i] - min_v
if min_v > a[i]:
min_v = a[i]
min_i = i
i = i +1
print index_pair, max_diff
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。