Answered step by step
Verified Expert Solution
Question
1 Approved Answer
There are N dishes in a line. You are given two arrays size and taste. For all ) , size, denotes the size of the
There are dishes in a line. You are given two arrays size and taste. For all size, denotes the size of the ith dish and taste denotes the taste of the i ith dish. You are allowed to eat at most dishes. The satisfaction of eating some dishes is given as follows:
Say if you eat different dishes, the value of satisfaction will be equal to the sum of the sizes of all dishes multiplied by the minimum taste among all the dishes.
Calculate the maximum satisfaction you can get after eating at most different dishes.
Function description
Complete the function solve. This function takes the following parameters and returns the required answer:
: Represents the total number of dishes
M: Represents the maximum number of dishes you can eat
size: Represents an array of sizes denoting the sizes of the dishes
taste: Represents an array of sizes denoting the tastes of the dishes
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