Available question text
Read a stream of non-negative integers, stopping when a zero is received. After the stream ends, return a random number from the stream such that each number is selected with probability proportional to how often it appeared (i.e., matching the empirical frequency distribution of the stream).
Related questions
Continue with questions that share topics or the same question type.
- Construct Smallest Number From DI String
Coding
- Count Odd Letters from Number
Coding
- Find Consecutive Integers from a Data Stream
Coding
- Find Median from Data Stream
Coding · Data Stream · Design · Heap (Priority Queue)
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
Google
Sample a Number from a Stream Proportional to Its Frequency
Reported Sep 5, 2024 · 1 source report
MID_LEVEL
Source snapshot: Nov 12, 2026
View source