Answered step by step
Verified Expert Solution
Question
1 Approved Answer
an event of Thanksgiving there is a feast organized for guests. The quantity of cake distributed among N guests is stored in an array plates.
an event of Thanksgiving there is a feast organized for guests. The quantity of cake distributed among N guests is stored in an array plates. However, on the day of the feast additional guests arrived and the manager now has no other way but to reduce the quantity of cakes from these plates. He wants to save at least M kilograms of cake for the extra guests that came in but wants to reduce the quantity of cake only from those plates which have more than or equal to K kilograms of cake.
You must help the manager to find and return the maximum value of K he can maintain after saving at least M kilograms of cake.
Input Specification:
input: An integer value N representing the number of guests.
input: An integer value M representing the minimum kilograms of cake that needs to be saved.
input: An integer array plates, where each element represents quantity of cake in each guest's plate.
Output Specification:
Retum the maximum value of K after saving M kilograms of cake
Example :
input :
input: S
Use
Need Help? Contact us Please add country code whil
Mets Online Assessment
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