[June LeetCoding Challenge] Random Pick Weight

Can anyone help me to explain why does the second example output like that? I don't know what should i do with pickIndex function. I thought that i just need to return a random index within range. But i got wrong answer. Thanks in advance.

Problem link: https://leetcode.com/explore/featured/card/june-leetcoding-challenge/539/week-1-june-1st-june-7th/3351/

Comments (5)