Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,22 @@
|
|||
on equilibriumIndices(sequence)
|
||||
script o
|
||||
property seq : sequence
|
||||
property output : {}
|
||||
end script
|
||||
|
||||
set loSum to 0
|
||||
set hiSum to 0
|
||||
repeat with value in o's seq
|
||||
set hiSum to hiSum + value
|
||||
end repeat
|
||||
repeat with i from 1 to (count o's seq)
|
||||
set value to o's seq's item i
|
||||
set hiSum to hiSum - value
|
||||
if (hiSum = loSum) then set o's output's end to i
|
||||
set loSum to loSum + value
|
||||
end repeat
|
||||
|
||||
return o's output
|
||||
end equilibriumIndices
|
||||
|
||||
equilibriumIndices({-7, 1, 5, 2, -4, 3, 0})
|
||||
Loading…
Add table
Add a link
Reference in a new issue