python-algorithm
leetcode 1464. Maximum Product of Two Elements in an Array
무적김두칠
2022. 3. 16. 16:10
1
2
3
4
5
6
7
|
class Solution:
def maxProduct(self, nums: List[int]) -> int:
first=max(nums)
nums.pop(nums.index(first))
second=max(nums)
ans=(first-1)*(second-1)
return ans
|
cs |
반응형