• after my understanding every 2nd zero from array should be "deleted"/"removed"/paired after with this logic in mind i've made my code it passes all the basic tests but for some reason on the random tests it fails :O

  • corrected

  • corrected

  • corrected

  • Wrong input in random tests: 2 more parameters (False and 1) are given.

  • still a problem even if it can be worked around.

    def pair_zeros(arr, *args):
    # just ignore *args and solve

  • Random test is reusing the same array object to perform its own computation to check if your solution is valid, so you shouldn't mutate the original array.

  • This is still an issue. Works with ganzinottis solution.

  • Thanks for the tip. I think we should still keep the issue open

  • I had exactly the same problem for one of the submission tests. My solution was to use the first argument and discard all the additional arguments that were given:

    def pair_zeros(*arr):
    arr = arr[0]

  • The submission tests for the python version seem to be in error. The pair_zeros function takes one argument
    but one of the tests passes it 3 arguments.

  • The random JavaScript tests seem to be flawed. All of the normal tests pass and all of the random tests fail with messages like the following, which seem to be replacing 0's with NaN rather than removing them:

    Testing for [0, 0, 7, 8, 9, 7, 6, 2, 6, 2, 0, 0, 0, 9, 4, 9]

    It should work for random inputs too - Expected: '[0, NaN, 7, 8, 9, 7, 6, 2, 6, 2, NaN, 0, 9, 4, 9]', instead got: '[0, 7, 8, 9, 7, 6, 2, 6, 2, 0, 0, 9, 4, 9]'

  • I have error:
    Testing for [8, 0, 0, 0, 7, 0, 4, 1, 5, 7, 0, 0, 6, 6, 1, 0, 0]
    It should work for random inputs too - Expected: [8,0,7,4,1,5,7,0,6,6,1], instead got: [8,0,0,7,4,1,5,7,0,6,6,1,0]
    But as I understand it should pairing in this way:

    source: [8, 0, 0, 0, 7, 0, 4, 1, 5, 7, 0, 0, 6, 6, 1, 0, 0]
    paired:     ^--^  ^-----^              ^--^           ^--^
    result: [8, 0,    0, 7,    4, 1, 5, 7, 0,    6, 6, 1, 0   ]
    

    At least according to rule "0's generated by pairing can NOT be paired again" for 8 zeros in source we should have 4 zeros in result.
    What is wrong - test or my understanding?

  • As I understand the rules, this test:
    Testing for [0, 0, 0, 3, 0, 4, 2, 0]

    should produce result:
    [0, 0, 3, 4, 2, 0]
    because arr[1] should collapsing with arr[0],
    arr[4] -> arr[2]
    and arr[7] stay at his place

    But expected result was: [0,3,4,2,0]

    How is that?

  • Loading more items...