Given an array nums containing N distinct integers and an integer K. You can perform any number of operations:
Select a sub-array of length K in nums and replace all the elements in the sub- array with the maximum number present in the current sub-array.
Find the minimum number of operations such that nums=nums[n].
The first line contains an integer N, where N denotes the number of elements in the array in the array. The second line contains N space- separated integers. The third line contains an integer, K.
Print the minimum number of operations such that nums nums[n].
•2sN,Ks10^5 • 1s am[i] $10^9
-I tried solving it but not able to find any optimal approach for the same.