Algorithm · Uber · Hard
Write a function solution(items, weights, k, seed) that performs weighted sampling without replacement over the sequence items. Each occurrence should be selected with probability proportional to its corresponding positive entry in weights, and no occurrence may be chosen more than once in one call. The returned list must preserve the relative order of the selected entries as they appear in items. If k is greater than or equal to the number of available items, or if k = 0,…
Checking your access…