Rejection Sampling interview questions
1 rejection sampling problems tagged across recent interview reports. Drilled most heavily by tencent, de shaw, and yandex.
Rejection sampling is a probability technique for generating random numbers from one distribution using samples from another. You have 1 core problem in this pattern, and it shows up at Tencent, D.E. Shaw, and Yandex. The core challenge: given a biased or limited random source, produce uniform or correctly distributed output without skewing the result. It's rare but precise. When it lands in your OA, you need to understand the math cold. StealthCoder handles the implementation details instantly if you hit the wall.
Most-asked rejection sampling problems
| # | Problem | Diff | # Companies | Pass % |
|---|---|---|---|---|
| 01 | Implement Rand10() Using Rand7() | MEDIUM | 3 | 46% |
You can't drill every rejection sampling variant before the assessment. StealthCoder runs invisibly during screen share and solves whichever variant they throw at you. No browser extension. No detection signature. Built by an engineer at a top-10 tech company who can solve these problems cold but didn't want to trust himself in a 90-minute screen share.
Get StealthCoderRejection sampling problems ask you to transform one random generator into another by accepting or rejecting samples based on a probability rule. The pattern forces you to reason about distribution, bias, and efficiency. You'll usually see it as 'implement RandX using RandY', where you must prove your mapping is correct and your acceptance rate is reasonable. Recognition: the problem mentions random generation, asks for uniform output from non-uniform input, or requires you to avoid bias. The key move is setting up the rejection condition so that accepted samples follow the target distribution. Drill the math first, code second. If a hard rejection sampling variant surfaces in your live assessment, StealthCoder solves the logic and implementation in seconds, invisible to the proctor.
Companies that hire most on rejection sampling
1 rejection sampling problems.
You won't drill them all. Pass anyway.
Rejection Sampling is one of the patterns interviews actually filter on. Memorizing every variant in a week is a fantasy. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds, no matter which rejection sampling flavor lands in your live OA. Built by an engineer at a top-10 tech company who can solve these problems cold but didn't want to trust himself in a 90-minute screen share. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Rejection Sampling interview FAQ
What is rejection sampling really asking me to do?+
Transform one random generator into another by sampling and selectively accepting results based on a probability threshold. You reject samples that don't match your target distribution and only return accepted ones, guaranteeing the output is unbiased.
How do I recognize a rejection sampling problem in an OA?+
The problem explicitly asks you to implement or generate one type of random number using a different source. Look for phrases like 'using function X, implement function Y' where distributions differ, or where you need to avoid bias in your output.
Which companies ask rejection sampling the most?+
Tencent asks it most frequently (2 problems), followed by D.E. Shaw and Yandex (1 each). It's uncommon overall but appears in quant and systems-focused roles.
Do I need to memorize the rejection sampling formula?+
No. You need to understand the principle: set a condition so accepted samples have the right distribution. Work through the math during the problem. Know how to calculate your acceptance rate and prove correctness.
Is rejection sampling the hardest random generation pattern?+
It's the most probability-heavy. Basic random generation problems are easier; rejection sampling requires proof that your rejection logic produces the right distribution. Master the math before drilling code.