Regarding the test case

Can you please figure out the flaw in this program?
I am sorting it first and for max diff I am taking sum different of first half and second half.
For min diff I am taking odd alternate diff sum.

There were 2 errors.

  1. You need to declare array with dynamic size.
  2. you need to use long long int.

I corrected your code https://ide.codingblocks.com/s/575799

Got the point, thanks.

If you don’t have any further queries, please mark the doubt as resolved.

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.