1874. Minimize Product Sum of Two Arrays

Updated: 2024-03-12
1 min read
[]

On This Page

LeetCode problem 1874

class Solution:
    def minProductSum(self, nums1: List[int], nums2: List[int]) -> int:
        nums1.sort()
        nums2.sort()
        n, res = len(nums1), 0
        for i in range(n):
            res += nums1[i] * nums2[n - i - 1]
        return res