Question: You are given an array A of N ( > = 3 ) distinct integers. Your friend Allen removes only 2 elements from this array,

You are given an array A of N
(
>
=
3
)
distinct integers. Your friend Allen removes only
2
elements from this array, adds a value
(
>
0
)
to all the remaining elements shuffles the array and leaves the newly formed array G for you. Your task is to return the minimum possible value that Allen had added to each element of array A to get to array G
.
It is guaranteed that atleast one such value which will be greater than
0
will always exist. Java code

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 Databases Questions!