2028. Find Missing Observations
On This Page
class Solution:
def missingRolls(self, rolls: List[int], mean: int, n: int) -> List[int]:
m = len(rolls)
s = (n + m) * mean - sum(rolls)
if s > n * 6 or s < n:
return []
res = [s // n] * n
for i in range(s % n):
res[i] += 1
return res