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 has a bug that incorrectly handles four zeros in sequence
example input data [9, 0, 0, 0, 0, 0, 9]
your code will return [ 9, 0, 9, 0, 0, 0, 0, 0 ]
Hi I checked
your code gives wrong result for
this sequence [9, 0, 0, 0, 9, 1, 2, 0,
1, 0, 1, 0, 3, 0, 0, 1,
9, 0, 0, 0, 0, 0, 0, 9] can you check locally
javascript kata tests output incorrectly expected results and obtained results from the user
you shouldn't post code like that; anyone can see it.
I added the spoiler flag to your comment
This comment is hidden because it contains spoiler information about the solution
Fixed. MRI 2.5 should be disabled now.
This happens when you have MRI 2.50 selected. Tests work when you change them to MRI 3.
I will try to disable 2.5.
For Ruby version, the tests are not valid
Even if I change it manually in test sample, attempt will fail so it is not possible to validate the kata
--> the method is not at the right position in the code, called before being defined
#<NoMethodError: undefined method `do_test' for main:Object>
--> the method 'expect' is valid for Rspec but not with the framework of Codewars
--> should use Test.assert_equals instead
It is not a kata suggestion.
This comment is hidden because it contains spoiler information about the solution
This is not even an issue with spec, the kata generates the expected answer before passing the argument to the user's function. In this case, the user is mutating the list as they iterate through it, causing issues. I'm closing this issue.
There is a
false
value in that input as well as[]
(an empty array). The actual input for that test is['a', 0, 0, 'b', null, 'c', 'd', 0, 1, false, 0, 1, 0, 3, [], 0, 1, 9, 0, 0, {}, 0, 0, 9]
.expected [ 'a', 'b', null, 'c', 'd', 1, 1, 3, 1, 9, {}, 9, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0 ] to deeply equal [ 'a', 'b', null, 'c', 'd', 1, false, 1, 3, [], 1, 9, {}, 9, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0 ]
means that your code returned[ 'a', 'b', null, 'c', 'd', 1, 1, 3, 1, 9, {}, 9, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0 ]
, but it should have returned[ 'a', 'b', null, 'c', 'd', 1, false, 1, 3, [], 1, 9, {}, 9, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0 ]
. The message you copied does not mention the input to the function.This problem is caused by a bug in your code. For future reference, the
issue
tag is meant to be used when there is a problem with the actual kata. You can use thequestion
tag if you need help with your own code.As to the reason this is happening, make sure your code isn't confusing
false
and[]
with0
.0
,false
, and[]
are all falsey values, so it seems like your code might be confusing them.I think this testcase is wrong
expected [ 'a', 'b', null, 'c', 'd', 1, 1, 3, 1, 9, {}, 9, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0 ] to deeply equal [ 'a', 'b', null, 'c', 'd', 1, false, 1, 3, [], 1, 9, {}, 9, +0, +0, +0, +0, +0, +0, +0, +0, +0, +0 ]
In the first array there is no 'false' however the second array has a false for some odd reason.
There is also not a square bracket in the first array, however there is one in the second array. Can you help me out ?
done
i litrally had to go study this before answering it.
C#:
params int[] ...
to be in-line with the description about passing argumentsLoading more items...