Sliding window maximum

0
Remix
  1. Given an array and a window size k, return the maximum of every window of k consecutive elements.
  2. As a class: put(number) adds a number to a stream and getMax() returns the largest of the last k numbers put.
AmazonCodingLast asked Aug 2026
No answer yet. Write the first one; the best answer gets endorsed.