what is wrong in this approach
sort array
then for max diff choose only last n/2 elements in one array and first n/2 in other
for min diff choose alternste elements in both the arrays
what is wrong in this approach
sort array
then for max diff choose only last n/2 elements in one array and first n/2 in other
for min diff choose alternste elements in both the arrays
Use long long int to prevent overflow and then your code works
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.