Simple JS solution O(n log(n))
Intuition\nTo get the best result min value of first array should be as close as possible to max value of second array.\n\nSince we are free to adjust the order
# Intuition\nTo get the best result min value of first array should be as close as possible to max value of second array.\n\nSince we are free to adjust the order, it\'s safe to assume that any number can be made either max of one array or min of another.\n\nKnowing that, we can check any possible pair.\n\nOut of all possible pairs, the most suitable ones are adjacent numbers of sorterd array.\n\n# Approach\nSort the array\nGet the smallest absolute difference between two adjacent numbers.\n\n# Complexity\n- Time complexity: O(n log(n))\n\n- Space complexity: O(1)\n\n# Code\n```\nvar findValueOfPartition = function(nums) {\n    nums.sort((a,b) => a-b)\n    let res = Infinity\n    \n    for (let i=0; i<nums.length-1; i++) {\n        const diff = Math.abs(nums[i] - nums[i+1])\n        if (diff < res) {\n            res = diff\n        }\n    }\n    \n    return res\n};\n```
['Sorting', 'JavaScript']