Estimate X from the Sum of Two Normals
Updated
Problem statement
X and Y are independent random variables. Both are normally distributed with mean 0. X has variance varX, and Y has variance varY.
You cannot see X or Y. You only see their sum Z = X + Y, and it equals z.
Return E[X | Z = z], the expected value of X given that the sum equals z. Your answer is accepted if its absolute error or its relative error is at most 10^-9.
Function
estimateXFromSum(varX: int, varY: int, z: double) → doubleExamples
Example 1
varX = 1varY = 1z = 2.0return = 1.0X and Y have the same variance, so they play the same role: E[X | Z = 2] equals E[Y | Z = 2]. The two guesses must add up to the known sum, 2, so each one is 1. The answer is 1.
Example 2
varX = 4varY = 1z = 10.0return = 8.0The sum has variance 4 + 1 = 5, and X brings 4 of it. So X gets the share 4/5 of the sum. The answer is 4/5 × 10 = 8.
Example 3
varX = 1varY = 3z = -2.0return = -0.5X brings 1 of the total variance 1 + 3 = 4, so its share is 1/4. The answer is 1/4 × (-2) = -0.5. A negative sum gives a negative guess.
Constraints
1 <= varX <= 10^61 <= varY <= 10^6-10^6 <= z <= 10^6
More Susquehanna International Group (SIG) interview questions
- Extract Company Tickers from NewsONSITE INTERVIEW · Seen Jul 2026
- AKQ Betting Game EquilibriumONSITE INTERVIEW · Seen May 2025
- Correct Three Protractor ReadingsONSITE INTERVIEW · Seen May 2025
- Catch Fish with Reusable BaitsOA · Seen Nov 2026
- Bold Play to Reach a GoalOA · Seen Nov 2026
- Cats, Truth and Who Has MoreOA · Seen Nov 2026
- Counting Cows by Their LegsOA · Seen Nov 2026
- Enough Muffins for the LineOA · Seen Nov 2026
- Expected Consecutive Pairs Among Chosen NumbersOA · Seen Nov 2026
- Four-by-Four Boundary GridOA · Seen Nov 2026
Similar questions at other companies
- Plus OneDruva · ONSITE INTERVIEW
- Rotate a Flat Image ClockwiseGoogle · ONSITE INTERVIEWGoogle interview questions
- Matrix MultiplicationeBay · ONSITE INTERVIEWeBay interview questions
- Maximum Product of Three IntegersPelatro · ONSITE INTERVIEW
- Climbing StairsAmazon · ONSITE INTERVIEW
- Maximum 69 NumberHSBC · ONSITE INTERVIEWHSBC interview questions
- Roman to IntegerKotak Mahindra Bank · PHONE SCREEN · ONSITE INTERVIEWKotak Mahindra Bank interview questions
- Exact-Sixty Dice Game ValueJane Street · ONSITE INTERVIEWJane Street interview questions
- Find the Missing Number from 1 to nHyperVerge · ONSITE INTERVIEW
- Alternating Index Square SumAccenture · ONSITE INTERVIEWAccenture interview questions