You are given two integer arrays nums1 and nums2, both of length n.
You can perform the following operations any number of times in any order:
Swap any two elements within the same array at a cost of
Swap an element nums1[i] with an element nums2[j] at a cost of
Return the minimum total cost required to make nums1 and nums2 identical. If it is impossible to make the two arrays identical, return
Constraints:
nums1.length nums2.length
nums1[i], nums2[i]
You are given two integer arrays nums1 and nums2, both of length n.
You can perform the following operations any number of times in any order:
Swap any two elements within the same array at a cost of
Swap an element nums1[i] with an element nums2[j] at a cost of
Return the minimum total cost required to make nums1 and nums2 identical. If it is impossible to make the two arrays identical, return
Constraints:
nums1.length nums2.length
nums1[i], nums2[i]