Maximum Average Subarray I

Try to solve the Maximum Average Subarray I problem.

Statement

Given an array of integers nums, and an integer k, return the maximum average of a contiguous subarray of length k.

Constraints:

  • 1≤1 \leqk ≤\leq nums.length ≤\leq 10510^5

  • −104≤-10^4 \leqnums[i] ≤104\leq 10^4

Examples

Level up your interview prep. Join Educative to access 80+ hands-on prep courses.