Ad
  • Custom User Avatar

    No worries, it happens to everyone at some point!

  • Custom User Avatar

    Well this is embarassing. That's exactly what happened. Thanks for your responses! :)

  • Custom User Avatar

    Are you sure that the 0 should equal 1 isn't referencing the test above the one that you're talking about? The input for that test is [1,0,0] and the correct answer for that test is indeed 1.

    The x should equal y will appear below the log for any test that you fail, not above it.

  • Custom User Avatar

    Haha it's always possible that I'm misreading it, but I don't think that's what's happening this time (I apologize if I am lol - and further, the numbers, as you point out, seem pretty convincing, so it wouldn't surprise me if I'm wrong). I added some code to print out relevant info and pasted the result below.

    0 should equal 1
    Log
    input is: [3, 7, -99, 81, 90211, 0, 7]
    solution is: 0
    solution's type is: <class 'int'>

  • Custom User Avatar

    Your solution can run into issues when the array contains duplicate values. I'll let you figure out why that might be exactly. I would also suggest maybe taking a different approach altogether. Not to be mean, but 3 nested loops are probably not the best solution to this problem.

  • Custom User Avatar

    That particular test case is a fixed one, and not random. I can confirm that this test actually expects 0 to be returned, and not 1. Is it possible you're reading the test result incorrectly? I checked in python, not sure about the other languages. Python also has almost 42,000 solves, so I'm guessing the problem isn't with the tests.

  • Custom User Avatar

    I apologize if this is the wrong area to post this - I'll redirect if needed. After clicking attempt, the following test case failed: [3, 7, -99, 81, 90211, 0, 7]. My solution suggested the answer is 0, which is in fact the correct solution. The test case expected 1 for the solution. So whatever generates the tests isn't working perfectly.