Data Structures
Random Pick with Weight
Random Pick with Weight (LeetCode 528): build prefix sums and binary-search a random target for O(log n) weighted sampling.
1 note tagged
Random Pick with Weight (LeetCode 528): build prefix sums and binary-search a random target for O(log n) weighted sampling.