nums
function maxProductDifference(nums: number[]): number { const sorted = nums.toSorted((a, b) => a - b) const [w, x] = sorted.slice(-2) const [y, z] = sorted.slice(0, 2) return (w * x) - (y * z) };