mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-09 19:44:45 +08:00
更新 053.最大子序和 排版格式修复
This commit is contained in:
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
## 算法公开课
|
## 算法公开课
|
||||||
|
|
||||||
**《代码随想录》算法视频公开课:[看起来复杂,其实是简单动态规划 | LeetCode:53.最大子序和](https://www.bilibili.com/video/BV19V4y1F7b5),相信结合视频再看本篇题解,更有助于大家对本题的理解**。
|
**[《代码随想录》算法视频公开课](https://programmercarl.com/other/gongkaike.html):[看起来复杂,其实是简单动态规划 | LeetCode:53.最大子序和](https://www.bilibili.com/video/BV19V4y1F7b5),相信结合视频再看本篇题解,更有助于大家对本题的理解**。
|
||||||
|
|
||||||
|
|
||||||
## 思路
|
## 思路
|
||||||
@ -97,8 +97,8 @@ public:
|
|||||||
|
|
||||||
## 其他语言版本
|
## 其他语言版本
|
||||||
|
|
||||||
|
### Java:
|
||||||
|
|
||||||
Java:
|
|
||||||
```java
|
```java
|
||||||
/**
|
/**
|
||||||
* 1.dp[i]代表当前下标对应的最大值
|
* 1.dp[i]代表当前下标对应的最大值
|
||||||
@ -140,7 +140,8 @@ class Solution {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Python:
|
### Python:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
class Solution:
|
class Solution:
|
||||||
def maxSubArray(self, nums: List[int]) -> int:
|
def maxSubArray(self, nums: List[int]) -> int:
|
||||||
@ -153,7 +154,8 @@ class Solution:
|
|||||||
return result
|
return result
|
||||||
```
|
```
|
||||||
|
|
||||||
Go:
|
### Go:
|
||||||
|
|
||||||
```Go
|
```Go
|
||||||
// solution
|
// solution
|
||||||
// 1, dp
|
// 1, dp
|
||||||
@ -184,7 +186,7 @@ func max(a,b int) int{
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
JavaScript:
|
### JavaScript:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
const maxSubArray = nums => {
|
const maxSubArray = nums => {
|
||||||
@ -203,8 +205,7 @@ const maxSubArray = nums => {
|
|||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Scala:
|
||||||
Scala:
|
|
||||||
|
|
||||||
```scala
|
```scala
|
||||||
object Solution {
|
object Solution {
|
||||||
@ -221,7 +222,7 @@ object Solution {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
TypeScript:
|
### TypeScript:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
function maxSubArray(nums: number[]): number {
|
function maxSubArray(nums: number[]): number {
|
||||||
@ -244,3 +245,4 @@ function maxSubArray(nums: number[]): number {
|
|||||||
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
|
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
|
||||||
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
|
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user