We can optimise it to O(N) i think. Let me know if I am correct. Here is the approach. Intialise countChanges = 0 Now, for each of the k jump list we do the following - 1. Check if current element is greater than the next element in that list . If current is greater then replace its value with the previous element in that list and do countChanges++ , else do nothing. (NOTE: if previous element not present i.e. if we are at first element of that list then consider previous as zero) 2. Move forward to next element in same list. Repeat step 1 until that list is exhausted. After this step we get minimum no. of changes required for that list to make it non-decreasing. 3. Now start with the next k jump list and perform same operations mentioned in step-1 and step-2. For example, If given list is [1,2,3,4,5,6,7,8,9] , and k =3, then perform step-1 and step-2 for following lists - [1,4,7] [2,5,8] [3,6,9] Sum up all the countChanges for above sequences to get final answer