Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -1,22 +0,0 @@
|
|||
function maxSubseq(sequence s)
|
||||
integer sum, maxsum, first, last
|
||||
maxsum = 0
|
||||
first = 1
|
||||
last = 0
|
||||
for i = 1 to length(s) do
|
||||
sum = 0
|
||||
for j = i to length(s) do
|
||||
sum += s[j]
|
||||
if sum > maxsum then
|
||||
maxsum = sum
|
||||
first = i
|
||||
last = j
|
||||
end if
|
||||
end for
|
||||
end for
|
||||
return s[first..last]
|
||||
end function
|
||||
|
||||
? maxSubseq({-1, -2, 3, 5, 6, -2, -1, 4, -4, 2, -1})
|
||||
? maxSubseq({})
|
||||
? maxSubseq({-1, -5, -3})
|
||||
Loading…
Add table
Add a link
Reference in a new issue