Ad
  • Default User Avatar

    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

  • Default User Avatar

    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.

  • Custom User Avatar

    With arrays you are better off using Test.assertSimilar().

  • Default User Avatar

    Have you tried Test.assertEquals(getEvenNumbers([1,2,4]), [2,4], "a message");?

  • Custom User Avatar

    From what bkaes is saying and by looking to your code the following wouldn't work:

    var HowMany = [1,6,0,5,0,0];
    var Type = ['house', 'car','jeans','pen','something','other'];
    

    Because it returns:

    ["jeans", "jeans", "jeans", "house", "pen", "car"] [0, 0, 0, 1, 5, 6]
    

    instead of

    ["jeans", "something", "other", "house", "pen", "car"] [0, 0, 0, 1, 5, 6]
    
  • Custom User Avatar

    Thanks, I am glad you appreciated it! :)

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    aLinked = [] removes the reference to the outside array, and therefore aLinked will stay the same outside your function. Note that your solution won't work on arrays that contain duplicate elements.

  • Custom User Avatar

    @Aliona_Kastsevich: Add the code in a comment, but mark it as a spoiler. Don't forget to add correct formatting.

  • Custom User Avatar

    It should display the difference between the results, isn't it?

  • Default User Avatar

    Is there a particular area that is confusing? Do you have a suggestion for an improvement?