Implement best-of-nn selection given a reward/verifier over sampled completions

Reasoning & Test-Time Compute2 / 4

Chapter 142 / 4

Reasoning & Test-Time Compute

Implement best-of-nn selection given a reward/verifier over sampled completions

Medium
Target interface
best_of_n(prompt, sample_fn, reward_fn, n=8)

Implement the function/class skeleton in the editor. Any correct approach is accepted.

Hints0 / 2
Reference solution
Your own code stays in the editor.