Amazon Interview Question

LeetCode Medium: Random Pick with Weight