Ad
  • Default User Avatar

    okay, I'm replying because I spent awhile staring at this and not understanding, trying to figure out how order mattered or somesuch. It appears that the random tests are evaluated after the test runs against your code. So if the original input is modified (via pop, for example), then the rolls passed to the test to validate are incorrect. It (likely) doesn't have anything to do with the result you are calculating.

  • Custom User Avatar

    @amberlovescats14 because the reference solution is called after the user's function, so if you mutate the input, well, the expected value changes. Normally reduce doesn't mutate the array you're working with, but that depends on what you do inside the reduce.

  • Default User Avatar

    @Chrono79 but why would mutating the array change the output?
    I just ran reduce and added a count based on the rules...

  • Custom User Avatar

    Already answered that same question in this same post.

    Are you mutating the input array/list, affecting the expected results?

  • Custom User Avatar

    Can someone explain me why this [2, 2, 6, 6, 6] should be 0? We've got three 6's.

  • Custom User Avatar

    Oh... I see... Yes I was. Sorry!

  • Custom User Avatar

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

  • Custom User Avatar

    Maybe there is something that I did not understand, but the random cases seem to be wrong in python... The triplets are never scored:
    [3, 3, 6, 3, 5] => 350 should equal 50
    [2, 2, 6, 6, 6] => 600 should equal 0
    [3, 4, 4, 4, 2] => 400 should equal 0
    etc.

    I pass the tests when there is no triplet though