What is randomly output? Is it an even distribution?


  • 0
    S

    There is a test case with [1,2,3,3,3], and pick(3) for 5000 times.
    I count the expected output, where there are 808 2's, 1665 3's and 2527 4's, and my output for 2,3,4 are evenly distributed around 1600+, which is a wrong answer.
    What does it mean by "return either index 2, 3, or 4 randomly"?


  • 0

    (800+) + (1700+) + (3200+) can't be 5000. Clearly you miscounted.

    Can't tell why you get Wrong Answer without seeing your code.


  • 0
    S

    Oops, the exact count is 808 2's, 1665 3's and 2527 4's


  • 0

    Still doubtful. And again: Can't tell why you get Wrong Answer without seeing your code. Can't do anything without it, really. Not sure why you're keeping it secret, making this hard instead of easy.


Log in to reply
 

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