Ad
  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    I'm also a big fan of not using magic numbers. Even in a "simple one-liner".

  • Custom User Avatar

    You're removing those numbers from the input, so, when the control function calculates its sum, it's using the other numbers: 136 + 128 + 83 = 347 Anyways, I've changed the tests so the expected value is computed first and your code messing with the input isn't a problem anymore, but be aware of that.

  • Custom User Avatar

    Don't mutate the input.

  • Default User Avatar

    In bigger projects i would expect such constants. That is much better, than 'magic' 0.5. But if we want just simple function... =)