Ad
  • Default User Avatar

    While I haven't submitted in JS, and I don't know if this is the case, what it looks like is that you are modifying the array in place, rather than making a copy. So the test cases create an array, then run your code on it. Then, in order to check your answer, they run their own doubling code on the same array. If you modified the array at all, then the answer won't be correct.

  • Custom User Avatar

    I'm also using JS and having the same problem. It looks like sample cases are working, but random are not. In fact, it looks like random cases are expecting a quadrupled answer instead of doubled, eg:

    Testing for 2,2,2,4,8,3 and 2

    It should work for random inputs too - Expected: '[8, 8, 8, 16, 32, 12]', instead got: '[4, 4, 4, 8, 16, 6]'

  • Custom User Avatar

    Same problem, with JavaScript. Solutions?

  • Default User Avatar

    Hi, which language?

  • Custom User Avatar

    Getting the same problem in both ruby and javascript.

  • Custom User Avatar

    I'm running into the same bug. It doesn't matter what I have it return, it is always expecting twice what I return:
    Test Results:
    Basic tests
    ✘ Expected: '[2, 4, 6]', instead got: '[10, 20, 30]'
    ✘ Expected: '[8, 2, 2, 2, 8]', instead got: '[40, 10, 10, 10, 40]'
    ✘ Expected: '[4, 4, 4, 4, 4, 4]', instead got: '[20, 20, 20, 20, 20, 20]'
    Completed in 6ms
    Random tests
    Testing for 8,6 and 3
    ✘ It should work for random inputs too - Expected: '[160, 120]', instead got: '[80, 60]'
    Completed in 1ms
    Testing for 2,5,6 and 4
    ✘ It should work for random inputs too - Expected: '[40, 100, 120]', instead got: '[20, 50, 60]'
    Testing for 8,9,9,3,6 and 5
    ✘ It should work for random inputs too - Expected: '[160, 180, 180, 60, 120]', instead got: '[80, 90, 90, 30, 60]'
    Testing for 9,8,1,1,9,6,1 and 9
    ✘ It should work for random inputs too - Expected: '[180, 160, 20, 20, 180, 120, 20]', instead got: '[90, 80, 10, 10, 90, 60, 10]'
    Testing for 2,7,8,3 and 3
    ✘ It should work for random inputs too - Expected: '[40, 140, 160, 60]', instead got: '[20, 70, 80, 30]'
    Completed in 1ms
    Testing for 3,8 and 5
    ✘ It should work for random inputs too - Expected: '[60, 160]', instead got: '[30, 80]'
    Completed in 1ms
    Testing for 4,8,5,3,8,8,3,5 and 9
    ✘ It should work for random inputs too - Expected: '[80, 160, 100, 60, 160, 160, 60, 100]', instead got: '[40, 80, 50, 30, 80, 80, 30, 50]'
    Testing for 1,7,2,8,8,1 and 4
    ✘ It should work for random inputs too - Expected: '[20, 140, 40, 160, 160, 20]', instead got: '[10, 70, 20, 80, 80, 10]'
    Completed in 1ms
    Testing for 7,2,2,8,7 and 8
    ✘ It should work for random inputs too - Expected: '[140, 40, 40, 160, 140]', instead got: '[70, 20, 20, 80, 70]'
    Completed in 1ms
    Testing for 4,8,2,7,3,3 and 8
    ✘ It should work for random inputs too - Expected: '[80, 160, 40, 140, 60, 60]', instead got: '[40, 80, 20, 70, 30, 30]'
    Testing for 4,9,1,7 and 9
    ✘ It should work for random inputs too - Expected: '[80, 180, 20, 140]', instead got: '[40, 90, 10, 70]'
    Testing for 1,7,8,4,4 and 6
    ✘ It should work for random inputs too - Expected: '[20, 140, 160, 80, 80]', instead got: '[10, 70, 80, 40, 40]'
    Testing for 8,2,6,7,9,7,7 and 3
    ✘ It should work for random inputs too - Expected: '[160, 40, 120, 140, 180, 140, 140]', instead got: '[80, 20, 60, 70, 90, 70, 70]'

  • Default User Avatar

    Same problem. Don't know what to do.

  • Custom User Avatar

    make a copy of array, and then start your work. ;-)