Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e64aced

Browse files
authored
Merge pull request #966 from iamyoshita/patch-1
Update 152-Maximum-Product-Subarray.py to reduce runtime
2 parents 26f0805 + 458069c commit e64aced

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

python/152-Maximum-Product-Subarray.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
class Solution:
22
def maxProduct(self, nums: List[int]) -> int:
33
# O(n)/O(1) : Time/Memory
4-
res = max(nums)
4+
res = nums[0]
55
curMin, curMax = 1, 1
66

77
for n in nums:

0 commit comments

Comments
 (0)