Leetcode 1574 Solution
This article provides solution to leetcode question 1574 (maximum-product-of-two-elements-in-an-array)
Access this page by simply typing in "lcs 1574" in your browser address bar if you have bunnylol configured.
Leetcode Question Link
class Solution: def maxProduct(self, nums: List[int]) -> int: max1 = 0 max2 = 0 for num in nums: if num >= max1: max2 = max1 max1 = num elif num >= max2: max2 = num return (max1 - 1) * (max2 - 1)