diff --git "a/leetcode3/\354\265\234\354\233\220\354\244\200/4074. Maximum Product Pair With Target Sum.py" "b/leetcode3/\354\265\234\354\233\220\354\244\200/4074. Maximum Product Pair With Target Sum.py" new file mode 100644 index 00000000..2a1504f5 --- /dev/null +++ "b/leetcode3/\354\265\234\354\233\220\354\244\200/4074. Maximum Product Pair With Target Sum.py" @@ -0,0 +1,18 @@ +class Solution: + def maxProductPair(self, nums: list[int], target: int) -> list[int]: + max_product = -float('inf') + ans = [-1, -1] + n = len(nums) + + for i in range(n): + for j in range(n): + num1 = nums[i] + num2 = nums[j] + + if num1 <= num2 or i == j: + continue + if num1 * num2 > max_product and num1 + num2 == target: + max_product = num1 * num2 + ans = [i, j] + + return ans