Divide array//////////////////

∑ i = 1 N / 2 a b s ( A i − B i )
what does this expression mean…
what does 1N signify

@dakshi hey,there are total n elements in array. you need to divide this array into two equal parts(A and B) each having n/2 elements. it means you pick up any n/2 elements from array and fill it in array A. other n/2 will be part of B array.
now programmatically the summation is(assume array is 1-indexed based):
sum = 0
for i = 1 to n/2
sum = sum + abs(A[i]-B[i]) //abs is absolute function. abs(-4)=abs(4)=4
what we need to do?
value of sum is dependent on your selection of A and B.
for eg. arr[]={1,2,3,4,5,6}
suppose you chose A={1,2,3}, B={4,5,6}, then sum = 3+3+3 = 9
another selection could be A={1,4,5} B={2,3,6} , then sum = 1+1+1 = 3
another selection could be A={3,4,5} B={2,1,6} , then sum = 1+3+1 = 5
so clearly sum depends on your selection of A and B.

your task: you need to find what is max possible value of sum and min possible value of sum.
like in above example sum=9 is max value and sum=3 is min value.

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.