Search
⌘K

Leetcode 2090. K Radius Subarray Averages

For each index i, compute the integer average of the subarray nums[i-k..i+k] (window size 2k+1) or -1 if the window goes out of bounds. The challenge is to produce the avgs array efficiently (n up to 1e5), typically via prefix sums or a sliding window to get O(n) time.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.