Tap here to switch tabs
Problem
Submissions

Problem: Find Missing Observations

Try to solve the Find Missing Observations problem.

Statement

You are given an integer array rolls of length m, representing the results of mm observations from rolling a 66 sided die with face values from 11 to 66. There are also nn missing observations.

You are also given an integer mean, which represents the average of all n+mn + m rolls.

Return an array of length n containing the missing roll values such that the average of all n+mn + m rolls is equal to mean. If multiple valid configurations exist, return any of them. If no valid configuration exists, return an empty array.

Note: The mean of a collection of values is the sum of the values divided by the total count of values.

Constraints:

  • m ==== rolls.length

  • 1≤1 \leq n, m ≤105\leq 10^5

  • 1≤1 \leq rolls[i], mean ≤6\leq 6

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Find Missing Observations

Try to solve the Find Missing Observations problem.

Statement

You are given an integer array rolls of length m, representing the results of mm observations from rolling a 66 sided die with face values from 11 to 66. There are also nn missing observations.

You are also given an integer mean, which represents the average of all n+mn + m rolls.

Return an array of length n containing the missing roll values such that the average of all n+mn + m rolls is equal to mean. If multiple valid configurations exist, return any of them. If no valid configuration exists, return an empty array.

Note: The mean of a collection of values is the sum of the values divided by the total count of values.

Constraints:

  • m ==== rolls.length

  • 1≤1 \leq n, m ≤105\leq 10^5

  • 1≤1 \leq rolls[i], mean ≤6\leq 6