Design a Population-Weighted Random Country Picker
Company: Apple
Role: Software Engineer
Category: Software Engineering Fundamentals
Difficulty: medium
Interview Round: Technical Screen
Overview: Design an immutable weighted random country picker whose selection probability is proportional to population. Precompute cumulative integer weights, draw uniformly over the total range, and use boundary-safe binary search with injectable randomness for deterministic tests.