2 ms·
The blog post discusses something else than just sum. Given an n length array of integers, and an integer k, output the max value for each k sized contiguous s
by JohnKemeny 2y ago
The blog post discusses something else than just sum.
Given an n length array of integers, and an integer k, output the max value for each k sized contiguous subarray.
sum is much easier than max.
- yorwba 2y agoThe Leetcode question for sliding window maximum is https://leetcode.com/problems/sliding-window-maximum/ https://leetcode.com/problems/sliding-window-maximum/ Which can be solved using a specialized implementation for max. But the article even discusses a generic solution for any monoid. Either sum or max is easier than sum and max and a bunch of other operations all at the same time.