How to test the equal probability ?

  • 0

    Just want to know the test case. How to test the results have equal probability ?

  • 0

    I also want to know the standard of accepting a submission.

    My code, using reservoir sampling, got accepted. But when I am playing with the Custom Testcase, for the default system given one, sometimes I get a different result from expected answer, and sometimes I get the same answer.

    Instead of testing edge cases, like picking a number that appears only once, testing normal cases will be hard. The way I can think of is that, for the same input nums array, continuously picking the same number and check if the probability of each possible index is approximately the same. Then how close is acceptable is an another question. If LeetCode has come up with a magic number, delta, I doubt they use this method to test our submissions. Because there are only 13 test cases. I think they are too few to test it out. However, if they don't test the probability equality, how can they accept a submission?

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.