Skip to content

2028. Find Missing Observations #482

Answered by topugit
mah-shamim asked this question in Q&A
Discussion options

You must be logged in to vote

We need to determine an array of missing rolls such that the average of all n + m dice rolls is exactly equal to mean. Here's the step-by-step breakdown of the solution:

Steps to Approach:

  1. Calculate the total sum for n + m rolls:
    Given that the average value of n + m rolls is mean, the total sum of all the rolls should be total_sum = (n + m) * mean.

  2. Determine the missing sum:
    The sum of the m rolls is already known. Thus, the sum of the missing n rolls should be:

    missing_sum = total_sum - ∑(rolls)
    

    where ∑(rolls) is the sum of the elements in the rolls array.

  3. Check for feasibility:
    Each roll is a 6-sided die, so the missing values must be between 1 and 6 (inclusive). Therefore, the …

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@mah-shamim
Comment options

mah-shamim Sep 5, 2024
Maintainer Author

@topugit
Comment options

topugit Sep 5, 2024
Collaborator

Answer selected by mah-shamim
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested medium Difficulty
2 participants