Return True with Probability p/q: Sampling Without Bias
5 min read Return True with Probability p/q: Sampling Without Bias “Given a function that returns a uniform random value, write a function […] Read article
// coding-interview-questions
Real coding questions, worked solutions, and the patterns behind them.
5 min read Return True with Probability p/q: Sampling Without Bias “Given a function that returns a uniform random value, write a function […] Read article
5 min read Multiply Two Integers Without Using Multiplication: Russian Peasant, Bit Shifts, Recursion “Multiply two integers without using the * operator” is Read article
5 min read Generate Random Numbers in a Range Using a Smaller Random Source “Given rand5() that returns a uniform integer 1–5, implement Read article
5 min read Compute x^y for Floats and Negative Exponents: Fast Exponentiation Computing pow(x, y) efficiently is LeetCode #50 and a frequently-asked interview Read article
2 min read I met three dragons. One always tells the truth, other one always lies and the last one alternates between lie Read article
5 min read Bayesian Weather Forecasting: How Forecasts Update with Evidence “How do you forecast tomorrow’s weather given today’s observation?” is a classic Read article
2 min read A half is a third of it. What is it? 2026 Update: The Half-Full Glass — Estimation and Fermi Problems Read article
1 min read When was the last year that looked the same upside down? (1961) 2026 Update: Strobogrammatic Numbers — Rotation Invariant Digits Read article
2 min read A book costs $1 plus half its price. How much does it cost? 2026 Update: The Interview Icebreaker — How Read article
3 min read You have 20 blue balls and 14 red balls in a bag. you put your hand in and remove 2 Read article
2 min read A man has two cubes on his desk. every day he arranges both cubes so that the front faces show Read article
2 min read In a country in which people only want boys, every family continues to have children until they have a boy. Read article
2 min read You can go to a fast food restaurant to buy chicken nuggets in 6-pack, 9-pack or 20-packs. is there such Read article
2 min read You have two identical crystal orbs. you need to figure out how high an orb can fall from a 100 Read article
2 min read Solution Not really much to solve 🙂 2026 Update: Parallel Lines — Geometry Algorithms and Line Intersection Determining if lines Read article
What's missing, wrong, or worth adding? One line helps.
Sent — thank you. We read every one.