First we sort our array then
For maximum element we can divide 0-n/2 in one array and n/2+1-n-1 in another array and get the result by above formula
For minimum we can divide our array by alternate elements to get the result
Can you check my approach is correct or not
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.