Ad
  • Custom User Avatar

    Please review: C++ Translation

  • Custom User Avatar

    I am attempting this kata in Ruby and passed all the test cases. However, in the random tests, if the input array has 3 + 0s in it I am failing.

    When I check the expected compared to my solution, the expected seems to have always deleted the 3rd & 4th 0 of the input array, but surely it should only be deleting the 4th as that's the second 0 in the pair. Surely only every other occourance should be deleted? I can see people have passed the test on Ruby so am I just missing something here? Some examples below:

    Examples:
    [5, 4, 3, 7, 4, 3, 2, 9, 2, 9, 7, 1, 2, 8, 0, 0, 3, 2, 7, 4, 5, 4, 9, 0, 4, 0, 5, 2, 5, 5, 4, 0, 2, 3, 5, 4, 6, 2, 5, 4, 9] input
    [5, 4, 3, 7, 4, 3, 2, 9, 2, 9, 7, 1, 2, 8, 0, 3, 2, 7, 4, 5, 4, 9, 4, 5, 2, 5, 5, 4, 0, 2, 3, 5, 4, 6, 2, 5, 4, 9] expected
    [5, 4, 3, 7, 4, 3, 2, 9, 2, 9, 7, 1, 2, 8, 0, 3, 2, 7, 4, 5, 4, 9, 0, 4, 5, 2, 5, 5, 4, 0, 2, 3, 5, 4, 6, 2, 5, 4, 9] my result

    [6, 3, 9, 2, 9, 0, 7, 7, 5, 4, 9, 1, 7, 6, 4, 5, 0, 6, 0, 9, 6, 6, 3, 9, 0, 2, 4, 5, 7, 3, 8, 1, 2, 9, 4, 7, 4, 0, 0, 6, 5, 4, 4, 4, 4, 2, 7, 8, 6, 1] input
    [6, 3, 9, 2, 9, 0, 7, 7, 5, 4, 9, 1, 7, 6, 4, 5, 6, 9, 6, 6, 3, 9, 2, 4, 5, 7, 3, 8, 1, 2, 9, 4, 7, 4, 0, 6, 5, 4, 4, 4, 4, 2, 7, 8, 6, 1] expected
    [6, 3, 9, 2, 9, 0, 7, 7, 5, 4, 9, 1, 7, 6, 4, 5, 6, 0, 9, 6, 6, 3, 9, 2, 4, 5, 7, 3, 8, 1, 2, 9, 4, 7, 4, 0, 6, 5, 4, 4, 4, 4, 2, 7, 8, 6, 1] my result

    [1, 4, 7, 5, 6, 0, 8, 1, 0, 6, 6, 5, 2, 2, 6, 2, 7, 4, 7, 0, 2, 3, 8, 4, 0, 9, 8] input
    [1, 4, 7, 5, 6, 0, 8, 1, 6, 6, 5, 2, 2, 6, 2, 7, 4, 7, 2, 3, 8, 4, 9, 8] expected
    [1, 4, 7, 5, 6, 0, 8, 1, 6, 6, 5, 2, 2, 6, 2, 7, 4, 7, 0, 2, 3, 8, 4, 9, 8] my result

    Thanks

  • Custom User Avatar

    Ruby 3.0 should be enabled.