You are given two integer arrays nums1 and nums2 of length n, where nums2 is a permutation of nums1.
In one operation, you can choose any contiguous subarray of nums1, extract it, and insert it at any position within the remaining elements.
Return the minimum number of operations required to transform nums1 into nums2.
Constraints:
n nums1.length nums2.length
nums1[i], nums2[i]
nums2 is a permutation of nums1.
You are given two integer arrays nums1 and nums2 of length n, where nums2 is a permutation of nums1.
In one operation, you can choose any contiguous subarray of nums1, extract it, and insert it at any position within the remaining elements.
Return the minimum number of operations required to transform nums1 into nums2.
Constraints:
n nums1.length nums2.length
nums1[i], nums2[i]
nums2 is a permutation of nums1.