Ad
  • Default User Avatar
  • Default User Avatar

    You may find your problem answered in the other issues posted here.

    Avoid changing the original arrays passed to your method as this may then affect the randomly generated tests.

  • Default User Avatar

    You're right, I did modify the array and so I modified my solution to not do so. I'll be more careful, thank you.

  • Default User Avatar

    Hi!

    Loving this kata in Ruby. I think I've found a solution but maybe also a problem with testing. On-submission tests are expecting nils when we've merged arrays with different sizes:

    Testing for:

    [{"c"=>5}, "c", "c", "s", "a"]

    ["w", {"s"=>5}, "a"]

    It should work for random inputs too - Expected: [{"c"=>5}, "w", "c", {"s"=>5}, "c", "a", "s", nil, "a", nil]

    This is, however, not the case for the default tests, where:

    ['a', 'b', 'c']

    [1, 2, 3, 4, 5]

    should yield: ['a', 1, 'b', 2, 'c', 3, 4, 5])

    No nils here. Please adjust the tests accoridngly as the instructions also indicate that nil should not be expected with arrays of different sizes.

    Thanks for the Ruby translation!

  • Default User Avatar

    Hey-ey!
    Thanks for the analysis. After viewing other solutions I was curious about the relative speed of this simple line.
    10k runs is great but should your test randomly generate sequences of numbers?

  • Default User Avatar

    Hey Giacomo!

    I'm going through the Ruby version and think that the random test cases on submission are all expecting a result of 0!
    Por ejemplo:

    Testing for a list of 73 elements
    It should work for random inputs too - Expected: 0, instead got: 127
    Testing for a list of 2379 elements
    It should work for random inputs too - Expected: 0, instead got: 17599
    Testing for a list of 698 elements
    It should work for random inputs too - Expected: 0, instead got: 1300
    Testing for a list of 4373 elements
    It should work for random inputs too - Expected: 0, instead got: 15626
    Testing for a list of 3894 elements
    It should work for random inputs too - Expected: 0, instead got: 16085

    Thanks for the translation :)