you give 0indexed array arr consist n positive integer positive integer kThe array arr call Kincreasing arrik arri hold index k n1For example arr 4 1 5 2 6 2 Kincreasing k 2 becausearr0 arr2 4 5arr1 arr3 1 2arr2 arr4 5 6arr3 arr5 2 2however arr Kincreasing k 1 arr0 arr1 k 3 arr0 arr3In operation choose index change arri positive integerReturn minimum number operation require array kincreasing give k Example 1input arr 54321 k 1Output 4explanationfor k 1 resultant array nondecreasingsome Kincreasing array form 56789 11111 22344 all require 4 operationsIt suboptimal change array example 678910 5 operationsIt show array kincreasing 4 operationsexample 2input arr 415262 k 2output 0explanationthis example problem descriptionHere index 2 5 arri2 arrisince give array kincreasing need perform operationsexample 3input arr 415262 k 3output 2explanationindice 3 5 one satisfy arri3 arri 3 5one way array kincreasing change arr3 4 arr5 5the array 415465note way array kincreasing require 2 operation Constraints1 arrlength 1051 arri k arrlength