Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Hi @Jchristian297 - for this kata, if you specify an index
i
, then the "left sum" is all elements to the left ofi
not including i itself and similarly for the "right sum" is all elements to the right ofi
not including i itselfSo let's look at
[5,6,444,2,7,2]
:In the above illustration, the answer is index
2
because to the left we have5+6 = 11
and to the right we have2+7+2 = 11
. NOTE WE DON'T INCLUDE444
in either sum.For your test case
[10,-80,10,10,15,35,20]
, if you say index0
, then the sum to the left of element10
is0
and the sum to the right is-80 + 10 + 10 + 15 + 35 + 20 = 10 != 0
.The correct answer here is index
6
because, to the left of index6
we have:10,-80,10,10,15,35
(note how we don't include20
) and to the right of index6
we have0
. And10 -80 + 10 + 10 + 15 + 35 = 0
as required.