Ad
  • Custom User Avatar

    Same here. Tests must have changed at some point?

    It's a way better solution than mine was, regardless!

  • Custom User Avatar

    My solution is months (possibly 12+) old. When I wrote it originally, I'm certain it conformed to the format. I suspect the instructions were changed in the meantime, but I have no way of verifying that.

  • Custom User Avatar

    In the above "solution," the result does not match the Instructions, but it does pass the tests. As soon as you run the solution, however, the assertion changes for the tests from the Instruction's format "( A:10 ) - ( B:20 )" to a dictionary format "{ A:10, B:20 }". You can see this by purposing failing a run of code, looking at the failure (note the format), then copy/pasting his solution, but change return to "1" or garbage. When you run it, you'll see the format requested by the tests in a different format!

    I don't know enough about TDD or the Assert library to understand this, but I would love to understand more. This solution matched mine, except that I did the proper formatting. I'm more curious why the testing got worked around than anything else. And also why people are upvoting something that isn't formatted right, smh lol!

  • Custom User Avatar

    Isn't res supposed to be a string, not an object? How does this solution work?

  • Custom User Avatar

    Just re-tested, output looks fine here.

  • Default User Avatar

    How is this a solution? I just tested it and it just returns an object with the keys being set to 0.