Leetcode Problem 2028. Find Missing Observations
2028. Find Missing Observations
AI Mock Interview
Leetcode Solutions
Distribute Missing Sum to Missing Observations
Solution Idea
Algorithm Steps
Code Implementation
Complexity Analysis
Calculate the current sum of the observed rolls.
Calculate the total sum required for all
n + m
rolls to achieve the given mean.
Subtract the current sum from the total sum to find the sum of the missing observations.
Check if the sum of the missing observations can be distributed within the range [1, 6] for each observation.
If possible, distribute the sum evenly across the
n
observations.
If there is a remainder after even distribution, increment some of the observations by 1 until the remainder is exhausted.
Return the array of missing observations if distribution is successful, otherwise return an empty array.
Backtracking to Find Missing Observations
Ask Question
Programming Language
Purpose:
General Question
Debug My Code
image/screenshot of info
(optional)
[+]
Full Screen
Loading...
Get Answer
Suggested Answer
Answer
Full Screen
Copy Answer Code
Loading...