Remitly interview question

Similar to leetcode medium Random Pick with Weight