If you are reading any value that is present innums1andnums2you are allowed to change your path to the other array. (Only one repeated value is considered in the valid path). Scoreis defined as the sum of uniques values in a valid path. Return the maximumscoreyou can obtain of all p...
r2 = 0 i, j = len(nums1)-1, len(nums2)-1 while i>=0 and j>=0: if nums1[i]>nums2[j]: r1 += nums1[i] i -= 1 elif nums1[i]<nums2[j]: r2 += nums2[j] j -= 1 else: r1 = r2 = nums1[i]+max(r1, r2) i -= 1 j -= 1 while i>=0: r1 += nums1[i...