This is a verified interview question from Teradata. Candidates reporting seeing this problem in recent Online Assessments (OAs) and onsite rounds. Mastering "Restaurant Menu Profit Optimization - Teradata Online Assessment IIT BHU" covers key patterns like Arrays.
"A restaurant chef has prepared N dishes, each with a unique satisfaction rating. The chef must decide which dishes to serve and in what order to maximize customer satisfaction. Each dish takes exactly 1 time unit to prepare and serve. The contribution of each dish is calculated as its satisfaction rating multiplied by the time slot it's served in (1st slot, 2nd slot, etc.). The chef can choose to discard any number of dishes and arrange the remaining ones in any order. Your task is to determine the maximum total satisfaction score achievable by optimally selecting and ordering the dishes. **Function Description:** Implement the function `calculateMaxSatisfaction` that takes the number of dishes and an array of satisfaction ratings, and returns the maximum possible total satisfaction score. **Function Parameters:** * **N:** An integer representing the number of dishes available * **satisfaction:** An array of N integers where each element represents the satisfaction rating of a dish **Return:** An integer representing the maximum total satisfaction score achievable. **Input Format:** * The first line contains a single integer N, the number of dishes. * The second line contains N space-separated integers representing the satisfaction ratings of each dish. **Output Format:** Print a single integer the maximum total satisfaction score. **Constraints:** * 1 <= N <= 500 * -1000 <=satisfaction[i] <=1000 --- **Sample Input 1** ```text 5 -1 -8 0 5 -9 ``` **Sample Output 1** ```text 14 ```"
Join thousands of developers practicing for Teradata.