LeetCode

Random Pick with Weight

Click here for an explanation.