NeetCode #271LC-644HardBinary SearchNC Algo100
← Back to All Problems

#271 · #644 · Maximum Average Subarray II(最大平均子段和 II)

📌 Problem Statement & Constraints

You are given an array nums of integers and an integer k. Find a contiguous subarray of length at least k with the maximum average value, and return that average. Constraints: 1 <= k <= nums.length <= 10^4, -10^4 <= nums[i] <= 10^4. The answer with a calculation error of 10^-5 is accepted.
🔒

Sign In to Unlock Full Solutions for All 973 Problems

Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!