Sample a Number from a Stream Proportional to Its Frequency | Hello Interview