From b720870da7a0c7d8388fd5b55bcaa1789764c5e2 Mon Sep 17 00:00:00 2001 From: Won Joon Thomas Choi <113500771+724thomas@users.noreply.github.com> Date: Mon, 26 Oct 2026 21:58:06 +0900 Subject: [PATCH] Create 4074. Maximum Product Pair With Target Sum.py --- ...4. Maximum Product Pair With Target Sum.py" | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 "leetcode3/\354\265\234\354\233\220\354\244\200/4074. Maximum Product Pair With Target Sum.py" 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