Skip to content

Commit a1577b9

Browse files
authored
Update max_subarray_product.md
1 parent 62b9359 commit a1577b9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

docs/max_subarray_product.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
### Given an integer array nums, find a subarray that has the largest product, and return the product.
22
### Maintaining both curr_max and curr_min is essential because a negative number
33
### Resetting on zero lets you "break" the subarray and start fresh.
4+
5+
46
```python
57
# Function to find the maximum product of a contiguous subarray
68
fn max_subarray_product(read nums: List[Int]) -> Int:
@@ -41,7 +43,6 @@ fn max_subarray_product(read nums: List[Int]) -> Int:
4143
return max_product
4244

4345

44-
# Entry point
4546
fn main():
4647
nums = List(2, 3, -2, 4) # Expected maximum product subarray: [2, 3] => 6
4748
max_product = max_subarray_product(nums)

0 commit comments

Comments
 (0)