3255. Find the Power of K-Size Subarrays II
You are given an array of integers
numsof lengthnand a positive integerk.The power of an array is defined as:
- Its maximum element if all of its elements are consecutive and sorted in ascending order.
- -1 otherwise.
You need to find the power of all subarrays of
numsof sizek.Return an integer array
resultsof sizen - k + 1, whereresults[i]is the power ofnums[i..(i + k - 1)].
1 | class Solution { |