#3254

Find the Power of K-Size Subarrays I

specialist · 685 · lc medium +30 · 62.1% accepted · 673 likes · top 63%

Description

You are given integer array nums of length n and positive integer k. The power of an array is its maximum element if all elements are consecutive ascending integers, otherwise -1.

Compute the power of every size-k subarray and return the results as array of size n - k + 1.

Code

1
2
3