Skip to content

Commit

Permalink
Implement Q53
Browse files Browse the repository at this point in the history
  • Loading branch information
wshs0713 committed Nov 16, 2021
1 parent 6e433bd commit 32ed19f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ My Leetcode practice.

## Dynamic Programming

### Easy

- [53. Maximum Subarray](/dynamic_programming/53_maximum_subarray.md)

## Graph

## Tree
Empty file removed dynamic_programming/.gitkeep
Empty file.
20 changes: 20 additions & 0 deletions dynamic_programming/53_maximum_subarray.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# \[Easy\] 53. Maximum Subarray

## Question

[\[Easy\] 53. Maximum Subarray](https://leetcode.com/problems/maximum-subarray/)

## Thought

Dynamic programming

## Code

```python
class Solution:
def maxSubArray(self, nums: List[int]) -> int:
for i in range(1, len(nums)):
nums[i] = max(nums[i] + nums[i-1], nums[i])

return max(nums)
```

0 comments on commit 32ed19f

Please sign in to comment.