Ad
  • Default User Avatar

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

  • Default User Avatar

    If the outlier is first in the list of integers or if it is second and preceded by a number of different parity then your code will not return anything causing the code to hit the time limit.

  • Default User Avatar

    I agree that it's optimal to stop searching immediately when the outlier is found rather than processing the entire list.

  • Default User Avatar

    I wasn't saying there's a point to doing it that way. And I agree that the tests are fine. Was just offering the possibility that maybe random tests were the reason why the OP was seeing different results upon submitting the same code more than once. I just joined codewars within the past few days, so wasn't aware of this, but if you are correct when you mentioned 'Random tests are not optional,' then random testing, as I also mentioned, is likely to be the reason.

  • Default User Avatar

    I noticed that as well. But it doesn't necessarily mean it's incorrect. I'm not sure if codewars works this way but it might be that kata can optionally have random test cases rather than a fixed set of test cases. Or maybe a fixed set in random order.

  • Default User Avatar

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

  • Default User Avatar

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

  • Default User Avatar

    You're probably over thinking it. This challenge is primarily very basic math along with output formatting. Nothing complicated. You can pretty much just ignore the term 'integral' in the problem statement and just follow the steps.

  • Default User Avatar

    In the problem description one of the requirements is that the result will always be an integer. So probably wanted only integers submitted in the solutions. 1.0 is equivalent to 1 but in this problem we are also seeing that there is a difference in how we get those two values, / versus //