There are n chocolates and the weight of the chocolates is given as an array of integers weights/n where weights] denote the weight of

There are n chocolates and the weight of the chocolates is given as an array of integers weights/n where weights] denote the weight of the chocolate. Every day, one can pick one chocolate, eat half of it, and put the remaining half back. Find the minimum possible total weight of the remaining chocolates after d'days. Note that one can eat the same chocolate multiple times. The weight of the part eaten can be calculated as floor(weights/12) Example: chocolates [30, 20, 251 d=4 Day Weight of the Weight chocolate picked eater Ramaining weight Result 1 20 10 10 [30,10,25] 2 25 12 13 (30.10. 13] 3 30 15 15 [15,10,13 4 15 7 18.10, 13] The total weight of chocolates on day 4 is 8-10 +13, which is the minimum pessible weight after 4 days. Function Description Complete the function find MinWeight in the editor below. FindMinWeight has the following parameters: int weightsin an array of integers representing weights of chocolates, indexed to -7 int d an integer representing the number of days Returns in the minimum total weight of chocolates after of days Constraints Ten10 Is weights 10 where Usin 1210
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Heres the solution for the problem described in the image Understanding the Problem We are given an array weights that represents the weight of chocol... View full answer

Get step-by-step solutions from verified subject matter experts
100% Satisfaction Guaranteed-or Get a Refund!
Step: 2Unlock detailed examples and clear explanations to master concepts

Step: 3Unlock to practice, ask and learn with real-world examples

See step-by-step solutions with expert insights and AI powered tools for academic success
-
Access 30 Million+ textbook solutions.
-
Ask unlimited questions from AI Tutors.
-
Order free textbooks.
-
100% Satisfaction Guaranteed-or Get a Refund!
Claim Your Hoodie Now!

Study Smart with AI Flashcards
Access a vast library of flashcards, create your own, and experience a game-changing transformation in how you learn and retain knowledge
Explore Flashcards