FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
PythonAlgorithms/LeetCode/0053_Maximum_Subarray.py at master · coder4321/PythonAlgorithms · GitHub
coder4321
PythonAlgorithms
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
PythonAlgorithms
/
LeetCode
/
0053_Maximum_Subarray.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
9 lines (9 loc) · 309 Bytes
Breadcrumbs
PythonAlgorithms
/
LeetCode
/
0053_Maximum_Subarray.py
Copy path
File metadata and controls
9 lines (9 loc) · 309 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
class
Solution
(
object
):
def
maxSubArray
(
self
,
nums
:
List
[
int
])
->
int
:
dp
=
[
0
]
*
len
(
nums
)
dp
[
0
]
=
nums
[
0
]
max_num
=
nums
[
0
]
for
i
in
range
(
1
,
len
(
nums
)):
dp
[
i
]
=
max
(
dp
[
i
-
1
]
+
nums
[
i
],
nums
[
i
])
if
dp
[
i
]
>
max_num
:
max_num
=
dp
[
i
]
return
max_num
Back
|
FazBrowse Home
|
New Git URL