please provide me the explanation of this question with respect to input and output in detail
Explanation of this question
Okay so the objective of the question is to divide the array into two arrays of size n/2, let’s say A and B.
And in the first case you want to maximize their difference and minimize their difference element wise.
So let’s see how the sample case works.
For maximum difference the split is as follows
A = {12,10} and B = {0,-3} so abs(12-0)+abs(10-(-3)) = 25
For minimum difference the split is as follows
A={12,0} and B = {10,-3} so abs(12-10)+abs(0-(-3)) = 5
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.