Random Pick with Weight
CodingOnsite, PhoneSoftware Engineer, Machine Learning EngineerReported Oct, 2026New
Company question banks are included with the Insider plan.
You are given a 0-indexed array of positive integers w where w[i] describes the weight of the i-th index.
You need to implement pickIndex(), which randomly picks an index in the range...