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.
I was also confused by the description, ignored it, looked at the test cases and then solved the kata.
Suggestion:
Length of output: n
Fill output with [1x, 2x, 3x, (...), nx]
If you think that would be too short: http://www.joelonsoftware.com/uibook/chapters/fog0000000062.html
Not sure what programming language you're using, but, "[optional] message" should be a string. Try it in quotes, like I have it here, for example, or replace it with a string variable. I see zvytas suggested basically the same thing. As for whether or not it will test arrays, I don't know. You may have to write your own array comparing function and pass the results of that to a test. Probably not... but I'm just learning the test stuff too, so I'm not sure yet. Also, it's different for different languages.
With arrays you are better off using
Test.assertSimilar()
.Have you tried Test.assertEquals(getEvenNumbers([1,2,4]), [2,4], "a message");?
From what bkaes is saying and by looking to your code the following wouldn't work:
Because it returns:
instead of
Thanks, I am glad you appreciated it! :)
This comment is hidden because it contains spoiler information about the solution
aLinked = []
removes the reference to the outside array, and thereforeaLinked
will stay the same outside your function. Note that your solution won't work on arrays that contain duplicate elements.@Aliona_Kastsevich: Add the code in a comment, but mark it as a spoiler. Don't forget to add correct formatting.
It should display the difference between the results, isn't it?
Is there a particular area that is confusing? Do you have a suggestion for an improvement?