From e9b0d46f3535546063192c170606bffa8ff75a32 Mon Sep 17 00:00:00 2001
From: jinbudaily <18336218010@163.com>
Date: Thu, 27 Jul 2023 14:41:58 +0800
Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20=E8=B4=AA=E5=BF=83?=
=?UTF-8?q?=E4=B8=8E=E5=8A=A8=E6=80=81=E8=A7=84=E5=88=92=20=E9=A2=9D?=
=?UTF-8?q?=E5=A4=96=E9=A2=98=E7=9B=AE=20=E6=8E=92=E7=89=88=E6=A0=BC?=
=?UTF-8?q?=E5=BC=8F=E4=BF=AE=E5=A4=8D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
problems/0005.最长回文子串.md | 23 ++++++++++---------
problems/0132.分割回文串II.md | 13 ++++++-----
problems/0649.Dota2参议院.md | 17 +++++++-------
.../0673.最长递增子序列的个数.md | 13 ++++++-----
4 files changed, 35 insertions(+), 31 deletions(-)
diff --git a/problems/0005.最长回文子串.md b/problems/0005.最长回文子串.md
index b1987b87..614f6051 100644
--- a/problems/0005.最长回文子串.md
+++ b/problems/0005.最长回文子串.md
@@ -30,17 +30,17 @@
* 输出:"a"
-# 思路
+## 思路
本题和[647.回文子串](https://programmercarl.com/0647.回文子串.html) 差不多是一样的,但647.回文子串更基本一点,建议可以先做647.回文子串
-## 暴力解法
+### 暴力解法
两层for循环,遍历区间起始位置和终止位置,然后判断这个区间是不是回文。
时间复杂度:O(n^3)
-## 动态规划
+### 动态规划
动规五部曲:
@@ -208,7 +208,7 @@ public:
* 时间复杂度:O(n^2)
* 空间复杂度:O(n^2)
-## 双指针
+### 双指针
动态规划的空间复杂度是偏高的,我们再看一下双指针法。
@@ -258,9 +258,9 @@ public:
-# 其他语言版本
+## 其他语言版本
-Java:
+### Java:
```java
// 双指针 动态规划
@@ -327,7 +327,7 @@ class Solution {
}
```
-Python:
+### Python:
```python
class Solution:
@@ -377,7 +377,7 @@ class Solution:
return s[start:end]
```
-Go:
+### Go:
```go
func longestPalindrome(s string) string {
@@ -411,7 +411,7 @@ func longestPalindrome(s string) string {
```
-JavaScript:
+### JavaScript:
```js
//动态规划解法
@@ -527,7 +527,7 @@ var longestPalindrome = function(s) {
};
```
-C:
+### C:
动态规划:
```c
@@ -615,7 +615,7 @@ char * longestPalindrome(char * s){
}
```
-C#:
+### C#:
動態規則:
```c#
@@ -681,3 +681,4 @@ public class Solution {
+
diff --git a/problems/0132.分割回文串II.md b/problems/0132.分割回文串II.md
index 9b164dfb..eb91a189 100644
--- a/problems/0132.分割回文串II.md
+++ b/problems/0132.分割回文串II.md
@@ -34,7 +34,7 @@
* 1 <= s.length <= 2000
* s 仅由小写英文字母组成
-# 思路
+## 思路
我们在讲解回溯法系列的时候,讲过了这道题目[回溯算法:131.分割回文串](https://programmercarl.com/0131.分割回文串.html)。
@@ -201,9 +201,9 @@ public:
```
-# 其他语言版本
+## 其他语言版本
-## Java
+### Java
```java
class Solution {
@@ -257,7 +257,7 @@ class Solution {
}
```
-## Python
+### Python
```python
class Solution:
@@ -286,7 +286,7 @@ class Solution:
return dp[-1]
```
-## Go
+### Go
```go
func minCut(s string) int {
@@ -330,7 +330,7 @@ func min(i, j int) int {
}
```
-## JavaScript
+### JavaScript
```js
var minCut = function(s) {
@@ -376,3 +376,4 @@ var minCut = function(s) {
+
diff --git a/problems/0649.Dota2参议院.md b/problems/0649.Dota2参议院.md
index a1420a66..db6b43df 100644
--- a/problems/0649.Dota2参议院.md
+++ b/problems/0649.Dota2参议院.md
@@ -42,7 +42,7 @@ Dota2 参议院由来自两派的参议员组成。现在参议院希望对一
因此在第二轮只剩下第三个参议员拥有投票的权利,于是他可以宣布胜利。
-# 思路
+## 思路
这道题 题意太绕了,我举一个更形象的例子给大家捋顺一下。
@@ -70,7 +70,7 @@ Dota2 参议院由来自两派的参议员组成。现在参议院希望对一
如果对贪心算法理论基础还不了解的话,可以看看这篇:[关于贪心算法,你该了解这些!](https://programmercarl.com/贪心算法理论基础.html) ,相信看完之后对贪心就有基本的了解了。
-# 代码实现
+## 代码实现
实现代码,在每一轮循环的过程中,去过模拟优先消灭身后的对手,其实是比较麻烦的。
@@ -111,9 +111,9 @@ public:
-# 其他语言版本
+## 其他语言版本
-## Java
+### Java
```java
class Solution {
@@ -145,7 +145,7 @@ class Solution {
}
```
-## Python
+### Python
```python
class Solution:
@@ -173,7 +173,7 @@ class Solution:
return "Radiant" if R else "Dire"
```
-## Go
+### Go
```go
@@ -214,7 +214,7 @@ func predictPartyVictory(senateStr string) string {
}
```
-## JavaScript
+### JavaScript
```js
var predictPartyVictory = function(senateStr) {
@@ -244,7 +244,7 @@ var predictPartyVictory = function(senateStr) {
};
```
-## TypeScript
+### TypeScript
```typescript
function predictPartyVictory(senate: string): string {
@@ -287,3 +287,4 @@ function predictPartyVictory(senate: string): string {
+
diff --git a/problems/0673.最长递增子序列的个数.md b/problems/0673.最长递增子序列的个数.md
index da80a4e0..0277f249 100644
--- a/problems/0673.最长递增子序列的个数.md
+++ b/problems/0673.最长递增子序列的个数.md
@@ -24,7 +24,7 @@
* 解释: 最长递增子序列的长度是1,并且存在5个子序列的长度为1,因此输出5。
-# 思路
+## 思路
这道题可以说是 [300.最长上升子序列](https://programmercarl.com/0300.最长上升子序列.html) 的进阶版本
@@ -221,9 +221,9 @@ public:
还有O(nlog n)的解法,使用树状数组,今天有点忙就先不写了,感兴趣的同学可以自行学习一下,这里有我之前写的树状数组系列博客:https://blog.csdn.net/youngyangyang04/category_871105.html (十年前的陈年老文了)
-# 其他语言版本
+## 其他语言版本
-## Java
+### Java
```java
class Solution {
@@ -257,7 +257,7 @@ class Solution {
}
```
-## Python
+### Python
```python
class Solution:
@@ -286,7 +286,7 @@ class Solution:
return result;
```
-## Go
+### Go
```go
@@ -332,7 +332,7 @@ func findNumberOfLIS(nums []int) int {
}
```
-## JavaScript
+### JavaScript
```js
var findNumberOfLIS = function(nums) {
@@ -364,3 +364,4 @@ var findNumberOfLIS = function(nums) {
+