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

Answered step by step
Verified Expert Solution
Question
72 users unlocked this solution today!
image text in transcribed

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

1 Expert Approved Answer
Link Copied!

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

blur-text-image
Question Has Been Solved by an Expert!

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

blur-text-image_2

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

blur-text-image_3

See step-by-step solutions with expert insights and AI powered tools for academic success

  • tick Icon Access 30 Million+ textbook solutions.
  • tick Icon Ask unlimited questions from AI Tutors.
  • tick Icon Order free textbooks.
  • tick Icon 100% Satisfaction Guaranteed-or Get a Refund!

Claim Your Hoodie Now!

Recommended Textbook for

Elementary Statistics

Authors: Robert R. Johnson, Patricia J. Kuby

11th Edition

978-053873350, 9781133169321, 538733500, 1133169325, 978-0538733502

More Books
flashcard-anime

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

Students Have Also Explored These Related Programming Questions!