Answered step by step
Verified Expert Solution
Question
1 Approved Answer
You have just rolled a dice several times. The N roll results that you remember are described by an array A . However, there are
You have just rolled a dice several times. The N roll results that you remember are described by an array A However, there are F rolls whose results you have forgotten. The arithmetic mean of all of the roll results the sum
of all the roll results divided by the number of rolls equals M
What are the possible results of the missing rolls?
Write a function:
function solutionA F M;
that, given an array A of length N an integer F and an integer M returns an array containing possible results of the missed rolls. The returned array should contain F integers from to valid dice rolls If such an array does
not exist then the function should return
Examples:
Given your function should return The arithmetic mean of all the rolls is
Given your function may return or among others
Given your function should return It is not possible to obtain such a mean.
Given your function should return It is not possible to obtain such a mean.
Write an efficient algorithm for the following assumptions:
N and F are integers within the range ;
each element of array A is an integer within the range ;
M is an integer within the range
Remember, all submissions are being checked for plagiarism. Your recruiter will be informed in case suspicious activity is detected. Please solve this in typescript. Thank you
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started