Divide sequence of n numbers into k distinct strictly increasing
Answers
Answered by
9
Given an array of n integers. Write a program to find minimum number of changes in array so that array is strictly increasing of integers. In strictly increasing array A[i] < A[i+1] for 0 <= i < n
Examples:
Input : arr[] = { 1, 2, 6, 5, 4}
Output : 2
We can change a[2] to any value
between 2 and 5.
and a[4] to any value greater then 5.
Input : arr[] = { 1, 2, 3, 5, 7, 11 }
Output : 0
Array is already strictly increasing.
Similar questions