The Find Missing Observations interview question is a probability-themed construction problem. You are given rolls of a 6-sided die, but you only know the results of of them. You are also given the average (mean) of all rolls. Your task is to reconstruct the missing rolls such that each roll is between 1 and 6, and the total average matches the target. If no such combination exists, return an empty array.
Microsoft and Google ask the Find Missing Observations coding problem to evaluate a candidate's ability to handle mathematical constraints and implement Greedy interview patterns. It tests whether you can translate a "mean" requirement into a "sum" requirement and then distribute that sum fairly across a set of containers (the die rolls).
This problem follows the Greedy Distribution and Math patterns.
TotalSum = mean * (n + m).MissingSum = TotalSum - Sum(m_rolls).MissingSum must be between and . If not, return [].MissingSum / n.MissingSum % n. Add 1 to the first remainder elements.
[6, 6].MissingSum is even possible with dice before attempting to construct the array.When distributing a value across slots, use quotient = V / N and remainder = V % N. Assigning quotient + 1 to the first remainder slots and quotient to the rest is the most uniform way to fill the slots.
| Title | Difficulty | Topics | LeetCode |
|---|---|---|---|
| Minimum Number of Operations to Reinitialize a Permutation | Medium | Solve | |
| Double Modular Exponentiation | Medium | Solve | |
| Cells with Odd Values in a Matrix | Easy | Solve | |
| Find Triangular Sum of an Array | Medium | Solve | |
| Count Mentions Per User | Medium | Solve |