mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-08 16:54:50 +08:00
更正了121、122、123、188md格式错误,好心干了坏事,把卡哥格式改了,吓死,赶紧改过来
This commit is contained in:
@ -194,7 +194,7 @@ public:
|
|||||||
|
|
||||||
## 其他语言版本
|
## 其他语言版本
|
||||||
|
|
||||||
### Java
|
Java:
|
||||||
|
|
||||||
> 贪心法:
|
> 贪心法:
|
||||||
|
|
||||||
@ -264,7 +264,7 @@ class Solution {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Python
|
Python:
|
||||||
|
|
||||||
> 贪心法:
|
> 贪心法:
|
||||||
```python
|
```python
|
||||||
@ -308,7 +308,7 @@ class Solution:
|
|||||||
return dp[(length-1) % 2][1]
|
return dp[(length-1) % 2][1]
|
||||||
```
|
```
|
||||||
|
|
||||||
### Go
|
Go:
|
||||||
|
|
||||||
```Go
|
```Go
|
||||||
func maxProfit(prices []int) int {
|
func maxProfit(prices []int) int {
|
||||||
@ -336,7 +336,7 @@ func max(a,b int)int {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### JavaScript
|
JavaScript:
|
||||||
|
|
||||||
> 动态规划
|
> 动态规划
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ public:
|
|||||||
|
|
||||||
## 其他语言版本
|
## 其他语言版本
|
||||||
|
|
||||||
### Java
|
Java:
|
||||||
|
|
||||||
```java
|
```java
|
||||||
// 贪心思路
|
// 贪心思路
|
||||||
@ -186,9 +186,8 @@ class Solution {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Python:
|
||||||
|
|
||||||
|
|
||||||
### Python
|
|
||||||
```python
|
```python
|
||||||
class Solution:
|
class Solution:
|
||||||
def maxProfit(self, prices: List[int]) -> int:
|
def maxProfit(self, prices: List[int]) -> int:
|
||||||
@ -212,7 +211,8 @@ class Solution:
|
|||||||
return dp[-1][1]
|
return dp[-1][1]
|
||||||
```
|
```
|
||||||
|
|
||||||
### Go
|
Go:
|
||||||
|
|
||||||
```golang
|
```golang
|
||||||
//贪心算法
|
//贪心算法
|
||||||
func maxProfit(prices []int) int {
|
func maxProfit(prices []int) int {
|
||||||
@ -248,7 +248,8 @@ func maxProfit(prices []int) int {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Javascript
|
Javascript:
|
||||||
|
|
||||||
贪心
|
贪心
|
||||||
```Javascript
|
```Javascript
|
||||||
var maxProfit = function(prices) {
|
var maxProfit = function(prices) {
|
||||||
@ -284,7 +285,8 @@ const maxProfit = (prices) => {
|
|||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
### C
|
C:
|
||||||
|
|
||||||
```c
|
```c
|
||||||
int maxProfit(int* prices, int pricesSize){
|
int maxProfit(int* prices, int pricesSize){
|
||||||
int result = 0;
|
int result = 0;
|
||||||
|
@ -188,7 +188,7 @@ dp[1] = max(dp[1], dp[0] - prices[i]); 如果dp[1]取dp[1],即保持买入股
|
|||||||
|
|
||||||
## 其他语言版本
|
## 其他语言版本
|
||||||
|
|
||||||
### Java
|
Java:
|
||||||
|
|
||||||
```java
|
```java
|
||||||
// 版本一
|
// 版本一
|
||||||
@ -244,7 +244,7 @@ class Solution {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Python
|
Python:
|
||||||
|
|
||||||
> 版本一:
|
> 版本一:
|
||||||
```python
|
```python
|
||||||
@ -311,9 +311,7 @@ func max(a,b int)int{
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
JavaScript:
|
||||||
|
|
||||||
### JavaScript
|
|
||||||
|
|
||||||
> 版本一:
|
> 版本一:
|
||||||
|
|
||||||
@ -352,7 +350,7 @@ const maxProfit = prices => {
|
|||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
### Go
|
Go:
|
||||||
|
|
||||||
> 版本一:
|
> 版本一:
|
||||||
```go
|
```go
|
||||||
|
@ -165,7 +165,7 @@ public:
|
|||||||
|
|
||||||
## 其他语言版本
|
## 其他语言版本
|
||||||
|
|
||||||
### Java
|
Java:
|
||||||
|
|
||||||
```java
|
```java
|
||||||
// 版本一: 三维 dp数组
|
// 版本一: 三维 dp数组
|
||||||
@ -252,7 +252,8 @@ class Solution {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Python
|
Python:
|
||||||
|
|
||||||
版本一
|
版本一
|
||||||
|
|
||||||
```python
|
```python
|
||||||
@ -285,7 +286,8 @@ class Solution:
|
|||||||
dp[j] = max(dp[j],dp[j-1]+prices[i])
|
dp[j] = max(dp[j],dp[j-1]+prices[i])
|
||||||
return dp[2*k]
|
return dp[2*k]
|
||||||
```
|
```
|
||||||
### Go
|
Go:
|
||||||
|
|
||||||
版本一:
|
版本一:
|
||||||
|
|
||||||
```go
|
```go
|
||||||
@ -357,7 +359,7 @@ func max(a,b int)int{
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Javascript
|
Javascript:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
// 方法一:动态规划
|
// 方法一:动态规划
|
||||||
|
Reference in New Issue
Block a user