Ad
  • Custom User Avatar

    Algorithim is not fast enough under larger numbers.. Increase the speed and it should help

  • Custom User Avatar

    Just for testing. It's not required

  • Default User Avatar

    In English, Y is almost always a vowel, in fact, rarely is it used as a consonant. This was quite a surprise when I made this discovery...

    I hope your day 10 months ago was good and I hope this turns out to also be a good day for you and everyone else.

  • Default User Avatar

    in English, Y is usually a vowel anyway, like the three out of four times you see it in this comment

  • Custom User Avatar

    Yes.

  • Custom User Avatar

    just Y ? :((

  • Default User Avatar

    Thank you for that expanation. It wasn't clear for me from description what really needed to be done.

  • Custom User Avatar

    @benjaminzwhite I would like to clarify if I understood the task correct. one of the tests consist the folow array [7,4,11,-11,39,36,10,-6,37,-10,-32,44,-26,-34,43,43] and the correct answer is 155, but my code can find another the highest value. Just look, please, [4,11,39,36,-6,37,44,-26,43,43] === 225. This is the maximum possible value. It is the reason why I ask, if I understood the task correct? Thank you!

  • Default User Avatar

    Thank you so much for writing that! Saved me a lot of confusion!

  • Custom User Avatar

    Thank you. I couldn't understand the instruction. After reading your post, i got the idea. Thanks.

  • Custom User Avatar

    thank you so much! I've been stuck on this for ages.

  • Default User Avatar

    Hi @Kippe and welcome to Codewars!

    You are allowed to pick a contiguous subarray of any length not just length = 4.

    So in the array you are asking about it turns out that the answer is the entire array sums up to 155 which is the maximum possible.

    Meanwhile, in the array [-1,-1,-2,100,230,-5,-7] the answer would be the subarray [100,230] which produces a sum of 330 which is the maximum possible, as for example including [-2,100,230,-5] would be less than 330 etc.

  • Default User Avatar

    Hi,

    i thought i understand, but how can
    ([7, 4, 11, -11, 39, 36, 10, -6, 37, -10, -32, 44, -26, -34, 43, 43]), 155)
    sum up to 155? I dont see a substring of length 4 in this that could return 155.

  • Custom User Avatar

    To anyone who doesn't understand the assignment: You have an array e.g [-2, 1, -3, 4, -1, 2, 1, -5, 4] You now have to find out which part of this array gives the biggest sum. In this case, it would be [4, -1, 2, 1] because 4 - 1 + 2 + 1 = 6. No other uninterrupted sequence in that array gives you a bigger sum.