mirror of
https://hub.njuu.cf/TheAlgorithms/Python.git
synced 2023-10-11 13:06:12 +08:00
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
f97d07ebd3
commit
9d6b99bdae
@ -1,7 +1,9 @@
|
|||||||
'''
|
"""
|
||||||
Maximum Product Subarray
|
Maximum Product Subarray
|
||||||
This algorithm finds the contiguous subarray within an array that has the largest product.
|
This algorithm finds the contiguous subarray within an array that has the largest product.
|
||||||
'''
|
"""
|
||||||
|
|
||||||
|
|
||||||
def maxProoductSubarray(nums, n):
|
def maxProoductSubarray(nums, n):
|
||||||
ans = nums[0]
|
ans = nums[0]
|
||||||
|
|
||||||
@ -20,4 +22,3 @@ def maxProoductSubarray(nums, n):
|
|||||||
nums = [1, -2, -3, 0, 7, -8, -2]
|
nums = [1, -2, -3, 0, 7, -8, -2]
|
||||||
n = len(nums)
|
n = len(nums)
|
||||||
print("Maximum Sub array is ", maxProoductSubarray(nums, n))
|
print("Maximum Sub array is ", maxProoductSubarray(nums, n))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user