Difficulty Level : Easy
Submissions : 145
Asked In :
Marks :10
: 2 | : 0
The cost of Array A is defined as:
Σn−11=(A[i]−A[i−1])2, 0 based indexing.
Insert any integer in any place in the array. Find the minimum possible cost after 1 such insertion.
The first line contains 1≤N≤104, denoting the number of elements in array A
Second line contains N integers denoting elements of array A ,1≤A[i]≤105
One Integers denoting minimum cost after 1 insertion
5 1 3 5 2 10
49
4 4 7 1 4
36
You need to login to view your submissions.
You need to login to view all submissions.
Result : Executed
Feel something is wrong with the test cases?
Result : Accepted
Test Cases :
But to Run or Submit the Problem, you need to Log In.
Continue to Log InYour challenge has been submitted successfully.
You will get a response soon via WhatsApp or Email.
Do let us know your issue.