Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You are given an array A of N ( 3 ) distinct integers Your Blend Allen removes only 2 elements from this array, adds a

You are given an array A of N (3) distinct integers Your Blend Allen removes only 2 elements from this array, adds a value (>0) to all the remisining elements, shulet array and leaves the newly formed array G for you.
Your task is to return the minimum possible value that Allen had added to sch element of array A to get to array G
Note:
1.it is guaranteed that at least one such value which will be greater than ways w
2.Consider 1 based indexing.
Input Specification:
input1: An integer value N, representing the size of array A
input2: An integer array A
input3: An integer array G created by Allen.
Output Specification:
Return the minimum possible value that Allen had added to each element of array A
Example 1:
input1:4
input2: {4,3,1,2}
input3:{7,4}
Output:3
Explanation:
By removing elements 3 and 2, present at second and fourth index respectively the array will become (4,1). Now by only adding 3(minimum value) to the remaining elements, the newly formed array G is [7,4). Since 3 is the minimum posible value required to be added to convert array A to G, therefore 3 is returned as the output

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

3.2 Discuss the strategic importance of technology in HRM.

Answered: 1 week ago