Ad
  • Custom User Avatar

    it is stated that text and numbers alternate, which it does not do in your output

    it is however a problem that the tests don't consistently catch that

  • Custom User Avatar

    It's your solution. Your solution fails on inputs where encoded text could also be a binary number, and you can see it in the output of the test that you included. Expected: 'wrqjvi, 0, dubb, 13, j... Your solution produced: instead got: 'wrqjvi, 0, dubb, 13, 6..., notice that you have two numbers in a row? Because j is 110, which can also be interpreted as a binary number. Your solution will fail on similar tests, you can add this to the sample tests: Test.assertEquals(decode('1011011011019800110110'), "aaa, 54"); to see it failing in real time.

    You just got lucky when you resubmitted your solution and the tests didn't generate a case like this one. The random tests might need to be hardened to make sure to include a "tricky" case like this, but as it is, there is nothing going "wrong" with the tests.