Not sure about the complexity of my JS implementation, but it seems a lot more readable to me. What are your thoughts?
const findMaxSlidingWindow = function(input, size) {
//Write your code
const output = [];
const len = input.length - size
function scan (i, size) {
let nums = []
for (let k = 0; k < size; k++) {
nums.push(input[i+k])
}
return nums
}
let i = 0
while(i <= len) {
output.push(Math.max(...scan(i, size)))
i++
}
console.log('window maximums', output)
return output;
};