Didn't understand the question!

I didn’t understand the question properly.
Is it difference per value which should be max/min or the total difference?
Additionally, in the example if I create the array {12,-3},{10,0}, the total difference can be made -1, but the ans given is 5.
Kindly help me out.

@varun.saxena

  1. They are talking about total difference of two arrays.
  2. See the equation carefully, here you have to take sum of absolute differences. In given example, if you create {12,-3}, {10,0}, total difference is |12-10|+|-3-0| = |2|+|-3| = 2+3=5 (here |a| denotes abs(a))

@varun.saxena
Use long long int, You code will work fine. Here is the updated code
https://ide.codingblocks.com/s/258456

Thanks. Implemented that same and it worked.