Random Pick with Weight
binary-searchprefix-sum
Problem
Given an array of positive integers w, implement pickIndex() that randomly picks an index in proportion to its weight.
Loading...
Given an array of positive integers w, implement pickIndex() that randomly picks an index in proportion to its weight.