Ad
  • Default User Avatar

    The test cases are written the wrong way around, so the expected and actual values are flipped.

    Also, this seems to lean a bit far on the physics side and not enough on the computer science side, but that's more my opinion

  • Custom User Avatar

    Thanks. I've updated the description accordingly.

  • Custom User Avatar

    It's assumed that the collision is perfectly elastic but it's not mentioned in the description.

    If collision is not perfectly elastic the solution cannot be determined, e.g for perfectly inelastic collisions the answer is trivial but does not equal to the expected result.

  • Custom User Avatar

    Thanks for spotting that. I've updated the test cases to test solutions for that now.

  • Custom User Avatar

    With an initial velocity of u = 0 there won't be any collision,
    which is not being tested for.

  • Custom User Avatar

    Yes, of course. Thanks for spotting that. I've fixed the solution now to remove the erroneous square.

  • Custom User Avatar

    The reference solution is wrong

    Momentum is p = mv
    But the reference solution produces mmv

    Not clear?
    Say inputs are m kg u (m/s) and alpha an constant
    Then p (kg*m/s)
    But the reference solution returns kg^2 * m/s

  • Custom User Avatar

    I had a little look at this Kata today and have a solution that solves the sample tests fine, but times out for the final tests. I'm finding it a little hard to find the root of the problem, as I'm unable to debug the cases. Any help would be greatly appreciated!