Implement weighted random choice | Pinterest Coding Question