End of Year Sale: Use Coupon Code END2025 to Get Extra 25% Off.
swap[0] to 1 and not_swap[0] to 0 since the first element can be considered as already sorted.i, check if nums1[i] and nums2[i] are both greater than nums1[i-1] and nums2[i-1] respectively (no swap needed at i-1), and also check if nums1[i] is greater than nums2[i-1] and nums2[i] is greater than nums1[i-1] (swap needed at i-1).swap[i] and not_swap[i] based on the conditions checked in step 3.swap[n-1] and not_swap[n-1].