Voile is correct - the example returns 6 because from the input (-2, 1, -3, 4, -1, 2, 1, -5, 4) you have to find the sequence which yields the highest sum.

That (as Voile correctly states) is "4, -1, 2, 1" because 4 - 1 = 3, then 3 + 2 = 5, then 5 + 1 = 6. There are negative numbers before (-3) and after (-5) this sub-sequence so the sub-sequence in the result is the yields the highest sum.

We can't find it because tests are failing on random arrays. I beleave they are generated randomly each time I submit result. Here is the screenshot: https://ibb.co/f9cWq33

Here are some examples:

With input: [31,30,-5,-38,48,46,38,-35,49,22,-8,22,-27,-17,12,34,-31]
Test Passed: Value == 202

Log
With input: [-9,47,1,15,-21,32,-25,36,49,-11,15,25,13,15,5,34,-22,38,-22,40,36,-19,6,-5,-21,-45,-10,-19,36,22,-1,-37,1,-25,-35,-31,49]
Expected: 300, instead got: 215

Log
With input: [50,-16,-15,-24,-5,22]
Expected: 50, instead got: 34

Log
With input: [-26,0,-46,-3,-12,37,-46,48,14,42,-35,-49,8,-41]
Test Passed: Value == 104

Log
With input: [32,50,-5,-32]
Test Passed: Value == 82

Log
With input: [2,-18,19,-20,25,-22,-7,-25,-39,31,-38,-6,10,-15,31,-10,48,3,-45,-19,-23,4,32,27,-29,4,36,44,9,46,-27,-42,-42,-22,15,43,-26,21,37,27,9,-42,9,-36,-4,-18,27,-33,-18,-21,45,34,4,37,7,2,26,22,-47,-15,49,-20,37,27,-13,-29,24,-18,-14]
Expected: 238, instead got: 205

I searched there and didn't find it. In your first line print the array (console.log(arr)) and press attempt. After that we could check if the array is exactly as you say

Why was Voile's answer downvoted?

Voile is correct - the example returns 6 because from the input (-2, 1, -3, 4, -1, 2, 1, -5, 4) you have to find the sequence which yields the highest sum.

That (as Voile correctly states) is "4, -1, 2, 1" because 4 - 1 = 3, then 3 + 2 = 5, then 5 + 1 = 6. There are negative numbers before (-3) and after (-5) this sub-sequence so the sub-sequence in the result is the yields the highest sum.

It's a little tip, but it helped me a lot!

I can get the random test cases to pass sometimes, and not others.

I had to rip out the random failling tests into my own tests to ensure it works.

This kata is so weak(all negative number seq return 0.wtf!) that it not worth 5kt.

Your solution maybe wrong.Try again.

Wow, this submission really tripped me up. I had to use a visualizer to see what was being done. Very clever.

Subarray does not have to include

multiplevalues; just one is enough.We can't find it because tests are failing on random arrays. I beleave they are generated randomly each time I submit result. Here is the screenshot: https://ibb.co/f9cWq33

Here are some examples:

With input: [31,30,-5,-38,48,46,38,-35,49,22,-8,22,-27,-17,12,34,-31]

Test Passed: Value == 202

Log

With input: [-9,47,1,15,-21,32,-25,36,49,-11,15,25,13,15,5,34,-22,38,-22,40,36,-19,6,-5,-21,-45,-10,-19,36,22,-1,-37,1,-25,-35,-31,49]

Expected: 300, instead got: 215

Log

With input: [50,-16,-15,-24,-5,22]

Expected: 50, instead got: 34

Log

With input: [-26,0,-46,-3,-12,37,-46,48,14,42,-35,-49,8,-41]

Test Passed: Value == 104

Log

With input: [32,50,-5,-32]

Test Passed: Value == 82

Log

With input: [2,-18,19,-20,25,-22,-7,-25,-39,31,-38,-6,10,-15,31,-10,48,3,-45,-19,-23,4,32,27,-29,4,36,44,9,46,-27,-42,-42,-22,15,43,-26,21,37,27,9,-42,9,-36,-4,-18,27,-33,-18,-21,45,34,4,37,7,2,26,22,-47,-15,49,-20,37,27,-13,-29,24,-18,-14]

Expected: 238, instead got: 205

Is it the thing I am missing?

[50,-16,-15,-24,-5,22] // Expected: 50, instead got: 34

I searched there and didn't find it. In your first line print the array (console.log(arr)) and press attempt. After that we could check if the array is exactly as you say

It was in the section of random tests.

I tried to do it in JavaScript however I dind't find any test case with these sequence: -47, 5, -29, -34.Anyway your result -24 is correct.

One of the Kata's tests cases for JS expects that -47, 5, -29, -34 should give 5 . I do not understand how?

Here are the all possible contiguous subsequences and their sums:

sum(-47, 5, -29, -34) = -105

sum(-47, 5, -29) = -71

sum(-47, 5) = -42

sum(5, -29) = -24

sum(5, -29, -34) = -58

sum(-29, -34) = -63

The highest sum is sum(5, -29) = -24 which my code gives.

My code works for the single example case provided in the description.

What am I missing?

It's a great Kata.

Can't run this kata with c#.

Even if i write return 0.

Solution.cs(1,11): error CS1585: Member modifier 'static' must precede the member type and name

## Loading more items...