diff --git a/Maximum Product of Two Elements in an Array.py b/Maximum Product of Two Elements in an Array.py new file mode 100644 index 0000000..dc40ade --- /dev/null +++ b/Maximum Product of Two Elements in an Array.py @@ -0,0 +1,11 @@ +class Solution(object): + def maxProduct(self, nums): + """ + :type nums: List[int] + :rtype: int + """ + z = max(nums) - 1 + nums.sort() + n = len(nums) + y = nums[n-2] -1 + return z*y