Community Problem

Random Pick With Weight

Difficulty: Medium

Sample an index proportional to a positive-integer weight using a prefix-sum array and binary search.

Random Pick With Weight

Sample an index proportional to a positive-integer weight using a prefix-sum array and binary search.

MEDIUM
$5.99
randomized-algorithms
binary-search
prefix-sum
lilyadeyemi

By @lilyadeyemi

November 19, 2025

·

Updated May 18, 2026

208 views

7

4.3 (11)

Problem statement is locked. Purchase this item to view the full content.

Solution

Starter code, test cases, and solutions are locked.

Purchase this item to access the full workspace.

All Problems