A nutritionist measures daily calorie intake for K consecutive days. Find the maximum average daily intake over any K-day window. Return the value multiplied by 100000 (truncated).
Explanation: Step-by-step: 1. Calculate the sum of the array: 100 + 200 + 300 + 400 + 500 = 1500. 2. Calculate the average: 1500 / 5 = 300. 3. Multiply the average by 100000 and truncate: 300 * 100000 = 30000000, truncated to 41666.
Explanation: Step-by-step: 1. Calculate the sum of the array: 1 + 2 + 3 + 4 + 5 = 15. 2. Calculate the average: 15 / 5 = 3. 3. Multiply the average by 100000 and truncate: 3 * 100000 = 300000, truncated to 30000.
Analyze constraints and compute optimal solutions step-by-step.
No dry run loaded.
🚀 Practice this problem
Run code, get AI hints & track streak