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.
Your solution only calculates the sum of the two highest elements which is not what the kata asks for.
Expected: equal to 0
Actual: 0
Seems quite the opposite to me. I thought it would be easy, but nope. Timed out.
@Jikuat, thanks so much but, why in the example didn't repeated 4 then? Itructions doesn't forbit it...
How do you know your solution is correct if tests do not pass? :)
hey, what's wrong with random test? It just doesn't works, but my solution is correct..
We cannot check the code because you did not show it. We cannot know what's wrong with your solution.
What's wrong with attempts test?! I tested in VS and result was correct. Please, check the code
Why are you spoiling the kata like that? Please don't.
This comment is hidden because it contains spoiler information about the solution
You are not checking every position of subarrays, instead of defining a fixed lookahead value, how about considering tracking previous accumulations and denote a logic to compute local maxima and global maxima?
When
i
is equal toarr.size() - 2
thenj
will becomearr.size() - 1
, but it will not enter the 2nd inner loop due to the condition here -->j < arr.size() - 2
.Also, your code will timeout because its time complexity is O(N^2) whereby an O(N) approach should suffice.
Read the description carefully
kata hint / knowledge sharing != kata suggestion.
In other words, it means
[]
should return0
, since there is nothing to sum against.Loading more items...