Quant Memo
Coding/●●●●●

Deal k cards uniformly at random

You have nn distinct items and want a hand of kk of them (knk \le n), drawn uniformly: every possible kk-item outcome equally likely.

Return kk items so that all (nk)\binom{n}{k} subsets are equally likely, using only a uniform random integer generator. Do the work in O(k)O(k) swaps, not O(n)O(n).

Your answer

This one is open-ended. Work it through, then check your reasoning against the full solution.

More Coding questions