Random Pick with Weight at Sony
Medium48.9% acceptance
This problem has 62.5% frequency at Sony.
Problem Description
You are given a **0-indexed** array of positive integers `w` where `w[i]` describes the **weight** of the `ith` index. You need to implement the function `pickIndex()`, which **randomly** picks an index in the range `[0, w.length - 1]` (**inclusive**) and returns it. The **probability** of picking...
Read full problem and hints