Ad
  • Custom User Avatar

    Thanks for writing this. I was passing the test but when i submitted i got "expected: but was:" on the true part, had no idea why. But this was the reason.

    Would be good if this was made clear in the description.

  • Custom User Avatar

    No special coding skill needed here, but some mathematic knowledge.

  • Custom User Avatar
  • Custom User Avatar

    Please use spoiler

  • Custom User Avatar

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

  • Custom User Avatar

    I don't know what O(1) time means.

    Constant time. No loops, or recursive function calls that are dependent of some variable. Look for Big-O-Notation.

    I am sort of storing the temps?

    Probably, but that's a little bit hard to answer without code.

    ? I have created an object …. Is this method too inefficient for the time requirement?

    It is fine, although the lookup in objects is O(log n) not O(1). Still fast enough for the kata. However, I think that your getMean isn't O(1), but O(k), where k is the number of different temperatures that have been encountered so far (by the way, this also called linear time complexity). So you probably need to speed up getMean a little bit.