ServiceNow | OA | Question
Anonymous User
1469

**PLEASE PROVIDE SOLUTION TO THIS PROBLEM...

Given two array A and B at a time we can perform only one operation on either array
decrease any array element by one or increase by one
we have to find minimum number of operation to make smallest element of array A greater than or equal to greatest element of array B
ex:-A=[1,2,2,3]
B=[1,2,3,4]
step1=>A=[2,2,2,3] count=1;
step2=>B=[1,2,2,4] count=2;
step3=>B=[1,2,2,3] count=3
step4=>B=[2,2,2,2] count=4;
answer is 4.

Comments (2)