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.
why post that?
do you happen to know how I can fully delete the kata?
it says I don't have permissions to delete my own kata.
It's gone now. I'll implement it on a better platform.
It's been awaiting moderator approval for over 6 months. The experience has been a complete waste of time.
That must be because I changed my vote after the discussion below.
This comment is hidden because it contains spoiler information about the solution
I started out with a dictionary-based solution too in Java and C#. But using that as a baseline, with the greatest inputs I could use in the tests, Array-based quadratic solutions were slipping through. It's just the overhead of the data structure relative to an array.
The whole point of this exercise is the challenge of coming up with a linear-time solution, so quadratic solutions need to fail.
Well... That's really a shame, the execution time is dependent on the implementation, compiler/interpreter. It means that on next CW's tests update this kata can be broken, as it happens with others. The only substantial difference between my solution and yours (in Python) is that I use a dictionary where you use an array. Checking a key is in a map is theoretically a time constant operation. Close this issue if you think it's fair. I think tests should be somehow released since it's not possible to reliably set them.
That's been resolved.
This comment is hidden because it contains spoiler information about the solution
In Ruby the function is not named correctly in the initial code.
I raise an issue since there is obviously one for me, this kata could be approved for now (with 2 kyu average rating o_O ), and as is this is not correct. In Python I have submitted a linear solution that passed all tests immediately. However this same solution does not pass any big test in Ruby nor in JS. Is there some magic solution that allows to solve this kata in a less than linear time complexity? I see two possibilities : or my solution in Python is really bad, and it should not pass, or it should pass in all the three languages I have mentionned.
Exactly.
Ah, please excuse me, I just thought that the sequence can consist of any numbers in the original array, that is, they can be unordered. And here we were talking about an ordered sequence, that is, an order, like the original array.
The longest non-negative sequence is 5 in the example you provided. you think it's 7 because you mistakenly omitted one of the -1 values in the sequence.
Loading more items...