Skip to content

Commit 7cbb4bf

Browse files
authored
Update max_sum_sub_array.md
1 parent 4270101 commit 7cbb4bf

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

docs/max_sum_sub_array.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
### It maintains the maximum sum seen so far and runs in O(n) time with O(1) space.
66

7+
```python
78
# Function to find the subarray with the maximum sum
89
fn max_sum_sub_array(nums: List[Int]) -> Int:
910
# If the list is empty, return 0 as no subarray exists
@@ -32,3 +33,5 @@ def main():
3233
nums = List(5,4,-1,7,8)
3334
max_sum = max_sum_sub_array(nums)
3435
debug_assert(max_sum == 23, "Assertion failed")
36+
```
37+
[Source](https://github.com/ratulb/mojo_programming/blob/main/codes/max_sum_sub_array.mojo)

0 commit comments

Comments
 (0)