DIY: Random Pick with Weight

Solve the interview question "Random Pick with Weight" in this lesson.

Problem statement

You are given an array of positive integers, w, where w[i] describes the weight of the ithi{th} ...