更新代码块

This commit is contained in:
youngyangyang04
2021-08-10 22:20:48 +08:00
parent c7c34dd824
commit 8a2d42013c
192 changed files with 552 additions and 552 deletions

View File

@@ -33,7 +33,7 @@
这道题目最直观的想法,就是暴力,找最优间距了。
```C++
```CPP
class Solution {
public:
int maxProfit(vector<int>& prices) {
@@ -59,7 +59,7 @@ public:
C++代码如下:
```C++
```CPP
class Solution {
public:
int maxProfit(vector<int>& prices) {
@@ -139,7 +139,7 @@ dp[5][1]就是最终结果。
以上分析完毕C++代码如下:
```C++
```CPP
// 版本一
class Solution {
public:
@@ -169,7 +169,7 @@ dp[i][1] = max(dp[i - 1][1], prices[i] + dp[i - 1][0]);
那么我们只需要记录 当前天的dp状态和前一天的dp状态就可以了可以使用滚动数组来节省空间代码如下
```C++
```CPP
// 版本二
class Solution {
public: