Question: Codewriting Given an array, return the minimum number of operations required to make all the elements of the array continuous. In one operation, any element

Codewriting
Given an array, return the minimum number of operations required to make all the elements of the array continuous. In one operation, any element of the array can be replaced with any integer.
Example
For arr =[6,4,1,7,10], the output should be solution(arr)=2.
In this example, the minimum number of operations needed to make all the elements of the array continuous is 2. You could replace 1 with 5 and 10 with 8 so that array will become arr =[6,4,5,7,8] which has continuous elelements.
Input/Output
[execution time limit]1 seconds (cpp)
[memory limit]108
Codewriting Given an array, return the minimum

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!