mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-08 16:54:50 +08:00
Update
This commit is contained in:
@ -9,7 +9,7 @@
|
||||
|
||||
> 切割问题其实是一种组合问题!
|
||||
|
||||
## 131.分割回文串
|
||||
# 131.分割回文串
|
||||
|
||||
[力扣题目链接](https://leetcode-cn.com/problems/palindrome-partitioning/)
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
]
|
||||
|
||||
|
||||
## 思路
|
||||
# 思路
|
||||
|
||||
关于本题,大家也可以看我在B站的视频讲解:[131.分割回文串(B站视频)](https://www.bilibili.com/video/BV1c54y1e7k6)
|
||||
|
||||
@ -210,7 +210,7 @@ public:
|
||||
};
|
||||
```
|
||||
|
||||
## 总结
|
||||
# 总结
|
||||
|
||||
这道题目在leetcode上是中等,但可以说是hard的题目了,但是代码其实就是按照模板的样子来的。
|
||||
|
||||
@ -244,12 +244,10 @@ public:
|
||||
|
||||
|
||||
|
||||
# 其他语言版本
|
||||
|
||||
|
||||
## 其他语言版本
|
||||
|
||||
|
||||
Java:
|
||||
## Java
|
||||
```Java
|
||||
class Solution {
|
||||
List<List<String>> lists = new ArrayList<>();
|
||||
@ -291,7 +289,7 @@ class Solution {
|
||||
}
|
||||
```
|
||||
|
||||
Python:
|
||||
## Python
|
||||
```python
|
||||
# 版本一
|
||||
class Solution:
|
||||
@ -341,8 +339,9 @@ class Solution:
|
||||
backtrack(s, 0)
|
||||
return res
|
||||
```
|
||||
Go:
|
||||
> 注意切片(go切片是披着值类型外衣的引用类型)
|
||||
## Go
|
||||
|
||||
注意切片(go切片是披着值类型外衣的引用类型)
|
||||
|
||||
```go
|
||||
func partition(s string) [][]string {
|
||||
@ -387,7 +386,7 @@ func isPartition(s string,startIndex,end int)bool{
|
||||
}
|
||||
```
|
||||
|
||||
javaScript:
|
||||
## javaScript
|
||||
|
||||
```js
|
||||
/**
|
||||
|
@ -52,7 +52,7 @@ dp[i][j]:以i-1为结尾的字符串word1,和以j-1位结尾的字符串word
|
||||
|
||||
从递推公式中,可以看出来,dp[i][0] 和 dp[0][j]是一定要初始化的。
|
||||
|
||||
dp[i][0]:word2为空字符串,以i-1为结尾的字符串word2要删除多少个元素,才能和word1相同呢,很明显dp[i][0] = i。
|
||||
dp[i][0]:word2为空字符串,以i-1为结尾的字符串word1要删除多少个元素,才能和word2相同呢,很明显dp[i][0] = i。
|
||||
|
||||
dp[0][j]的话同理,所以代码如下:
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
|
||||
<p align="center">
|
||||
<a href="https://github.com/youngyangyang04/leetcode-master" target="_blank">
|
||||
<img src="https://code-thinking-1253855093.file.myqcloud.com/pics/20210924105952.png" width="800"/>
|
||||
<a href="https://mp.weixin.qq.com/s/QVF6upVMSbgvZy8lHZS3CQ" target="_blank">
|
||||
<img src="https://code-thinking-1253855093.file.myqcloud.com/pics/20210924105952.png" width="1000"/>
|
||||
</a>
|
||||
|
||||
|
||||
# HR面注意事项
|
||||
|
||||
[知识星球](https://mp.weixin.qq.com/s/QVF6upVMSbgvZy8lHZS3CQ)里已经有一些录友开始准备HR面。
|
||||
|
@ -1,3 +1,7 @@
|
||||
<p align="center">
|
||||
<a href="https://mp.weixin.qq.com/s/QVF6upVMSbgvZy8lHZS3CQ" target="_blank">
|
||||
<img src="https://code-thinking-1253855093.file.myqcloud.com/pics/20210924105952.png" width="1000"/>
|
||||
</a>
|
||||
|
||||
# 特殊的七夕
|
||||
|
||||
|
@ -1,3 +1,8 @@
|
||||
<p align="center">
|
||||
<a href="https://mp.weixin.qq.com/s/QVF6upVMSbgvZy8lHZS3CQ" target="_blank">
|
||||
<img src="https://code-thinking-1253855093.file.myqcloud.com/pics/20210924105952.png" width="1000"/>
|
||||
</a>
|
||||
|
||||
# 不少录友想放弃秋招了.....
|
||||
|
||||
马上就要九月份了,互联网大厂的秋招的序幕早已拉开。
|
||||
|
@ -1,3 +1,10 @@
|
||||
<p align="center">
|
||||
<a href="https://mp.weixin.qq.com/s/QVF6upVMSbgvZy8lHZS3CQ" target="_blank">
|
||||
<img src="https://code-thinking-1253855093.file.myqcloud.com/pics/20210924105952.png" width="1000"/>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
# 你简历里的「专业技能」写的够专业么?
|
||||
|
||||
|
||||
|
@ -1,3 +1,7 @@
|
||||
<p align="center">
|
||||
<a href="https://mp.weixin.qq.com/s/QVF6upVMSbgvZy8lHZS3CQ" target="_blank">
|
||||
<img src="https://code-thinking-1253855093.file.myqcloud.com/pics/20210924105952.png" width="1000"/>
|
||||
</a>
|
||||
|
||||
# 关于实习,大家可能有点迷茫!
|
||||
|
||||
|
@ -1,3 +1,7 @@
|
||||
<p align="center">
|
||||
<a href="https://mp.weixin.qq.com/s/QVF6upVMSbgvZy8lHZS3CQ" target="_blank">
|
||||
<img src="https://code-thinking-1253855093.file.myqcloud.com/pics/20210924105952.png" width="1000"/>
|
||||
</a>
|
||||
|
||||
# 秋招和提前批都越来越提前了....
|
||||
|
||||
|
@ -1,3 +1,8 @@
|
||||
<p align="center">
|
||||
<a href="https://mp.weixin.qq.com/s/QVF6upVMSbgvZy8lHZS3CQ" target="_blank">
|
||||
<img src="https://code-thinking-1253855093.file.myqcloud.com/pics/20210924105952.png" width="1000"/>
|
||||
</a>
|
||||
|
||||
# 程序员应该这么写简历!
|
||||
|
||||
自运营[知识星球](https://mp.weixin.qq.com/s/QVF6upVMSbgvZy8lHZS3CQ)以来,我已经给星球里的录友们看了 一百多份简历,并准对大家简历上的问题都给出了对应的详细建议。
|
||||
|
@ -1,3 +1,8 @@
|
||||
<p align="center">
|
||||
<a href="https://mp.weixin.qq.com/s/QVF6upVMSbgvZy8lHZS3CQ" target="_blank">
|
||||
<img src="https://code-thinking-1253855093.file.myqcloud.com/pics/20210924105952.png" width="1000"/>
|
||||
</a>
|
||||
|
||||
# 究竟什么时候用库函数,什么时候要自己实现
|
||||
|
||||
在[知识星球](https://mp.weixin.qq.com/s/QVF6upVMSbgvZy8lHZS3CQ)里有录友问我,刷题究竟要不要用库函数? 刷题的时候总是禁不住库函数的诱惑,如果都不用库函数一些题目做起来还很麻烦。
|
||||
|
@ -1,3 +1,8 @@
|
||||
<p align="center">
|
||||
<a href="https://mp.weixin.qq.com/s/QVF6upVMSbgvZy8lHZS3CQ" target="_blank">
|
||||
<img src="https://code-thinking-1253855093.file.myqcloud.com/pics/20210924105952.png" width="1000"/>
|
||||
</a>
|
||||
|
||||
# 代码随想录上的题目最好刷两遍以上
|
||||
|
||||
今天秋招可能要提前很多,往年9月份开始秋招,今天可能9月份就已经结束了,所以 正在准备秋招的录友,还是要抓紧时间了。。
|
||||
|
@ -1,3 +1,8 @@
|
||||
<p align="center">
|
||||
<a href="https://mp.weixin.qq.com/s/QVF6upVMSbgvZy8lHZS3CQ" target="_blank">
|
||||
<img src="https://code-thinking-1253855093.file.myqcloud.com/pics/20210924105952.png" width="1000"/>
|
||||
</a>
|
||||
|
||||
# 本硕非计算机博士,如果找计算机相关工作
|
||||
|
||||
在[知识星球](https://mp.weixin.qq.com/s/QVF6upVMSbgvZy8lHZS3CQ)里,有一位博士录友,本硕都不是计算机,博士转的计算机,问了这样一个问题
|
||||
|
@ -1,3 +1,8 @@
|
||||
<p align="center">
|
||||
<a href="https://mp.weixin.qq.com/s/QVF6upVMSbgvZy8lHZS3CQ" target="_blank">
|
||||
<img src="https://code-thinking-1253855093.file.myqcloud.com/pics/20210924105952.png" width="1000"/>
|
||||
</a>
|
||||
|
||||
# 合适自己的,才是最好的!
|
||||
|
||||
秋招已经进入下半场了,不少同学也拿到了offer,但不是说非要进大厂,每个人情况都不一样,**合适自己的,就是最好的!**。
|
||||
|
@ -1,3 +1,8 @@
|
||||
<p align="center">
|
||||
<a href="https://mp.weixin.qq.com/s/QVF6upVMSbgvZy8lHZS3CQ" target="_blank">
|
||||
<img src="https://code-thinking-1253855093.file.myqcloud.com/pics/20210924105952.png" width="1000"/>
|
||||
</a>
|
||||
|
||||
# 要开始准备2022届的秋招了
|
||||
|
||||
在[知识星球](https://mp.weixin.qq.com/s/QVF6upVMSbgvZy8lHZS3CQ)里准备秋招的录友还真不少,也会回答过不少关于秋招的问题。
|
||||
|
@ -1,3 +1,8 @@
|
||||
<p align="center">
|
||||
<a href="https://mp.weixin.qq.com/s/QVF6upVMSbgvZy8lHZS3CQ" target="_blank">
|
||||
<img src="https://code-thinking-1253855093.file.myqcloud.com/pics/20210924105952.png" width="1000"/>
|
||||
</a>
|
||||
|
||||
# 大厂的新人培养体系是什么样的
|
||||
|
||||
之前我一直在[知识星球](https://mp.weixin.qq.com/s/QVF6upVMSbgvZy8lHZS3CQ)和大家讲,能进大厂一定要进大厂,大厂有比较好的培养体系。
|
||||
|
@ -1,3 +1,7 @@
|
||||
<p align="center">
|
||||
<a href="https://mp.weixin.qq.com/s/QVF6upVMSbgvZy8lHZS3CQ" target="_blank">
|
||||
<img src="https://code-thinking-1253855093.file.myqcloud.com/pics/20210924105952.png" width="1000"/>
|
||||
</a>
|
||||
|
||||
# 已经在实习的录友如何准备秋招?
|
||||
|
||||
|
@ -1,3 +1,7 @@
|
||||
<p align="center">
|
||||
<a href="https://mp.weixin.qq.com/s/QVF6upVMSbgvZy8lHZS3CQ" target="_blank">
|
||||
<img src="https://code-thinking-1253855093.file.myqcloud.com/pics/20210924105952.png" width="1000"/>
|
||||
</a>
|
||||
|
||||
# 客三消!
|
||||
|
||||
|
@ -1,3 +1,7 @@
|
||||
<p align="center">
|
||||
<a href="https://mp.weixin.qq.com/s/QVF6upVMSbgvZy8lHZS3CQ" target="_blank">
|
||||
<img src="https://code-thinking-1253855093.file.myqcloud.com/pics/20210924105952.png" width="1000"/>
|
||||
</a>
|
||||
|
||||
# 技术不太好,也不知道对技术有没有兴趣,我该怎么选?
|
||||
|
||||
|
@ -1,3 +1,9 @@
|
||||
<p align="center">
|
||||
<a href="https://mp.weixin.qq.com/s/QVF6upVMSbgvZy8lHZS3CQ" target="_blank">
|
||||
<img src="https://code-thinking-1253855093.file.myqcloud.com/pics/20210924105952.png" width="1000"/>
|
||||
</a>
|
||||
|
||||
# 不知不觉华为提前提已经开始了
|
||||
|
||||
最近华为提前批已经开始了,不少同学已经陆续参加了提前批的面试。
|
||||
|
||||
|
@ -1,3 +1,7 @@
|
||||
<p align="center">
|
||||
<a href="https://mp.weixin.qq.com/s/QVF6upVMSbgvZy8lHZS3CQ" target="_blank">
|
||||
<img src="https://code-thinking-1253855093.file.myqcloud.com/pics/20210924105952.png" width="1000"/>
|
||||
</a>
|
||||
|
||||
# 秋招下半场依然没offer,怎么办?
|
||||
|
||||
|
@ -1,3 +1,7 @@
|
||||
<p align="center">
|
||||
<a href="https://mp.weixin.qq.com/s/QVF6upVMSbgvZy8lHZS3CQ" target="_blank">
|
||||
<img src="https://code-thinking-1253855093.file.myqcloud.com/pics/20210924105952.png" width="1000"/>
|
||||
</a>
|
||||
|
||||
# 秋招上半场的总结
|
||||
|
||||
|
@ -1,3 +1,8 @@
|
||||
<p align="center">
|
||||
<a href="https://mp.weixin.qq.com/s/QVF6upVMSbgvZy8lHZS3CQ" target="_blank">
|
||||
<img src="https://code-thinking-1253855093.file.myqcloud.com/pics/20210924105952.png" width="1000"/>
|
||||
</a>
|
||||
|
||||
# 秋招进行时,其实大家都很焦虑
|
||||
|
||||
大家应该都发现了,提前批和秋招都越来越提前的,大部分的录友此时的心态还是挺焦虑的。
|
||||
|
@ -1,3 +1,8 @@
|
||||
<p align="center">
|
||||
<a href="https://mp.weixin.qq.com/s/QVF6upVMSbgvZy8lHZS3CQ" target="_blank">
|
||||
<img src="https://code-thinking-1253855093.file.myqcloud.com/pics/20210924105952.png" width="1000"/>
|
||||
</a>
|
||||
|
||||
# 对程序员来说,英语到底重不重要
|
||||
|
||||
在[知识星球](https://mp.weixin.qq.com/s/QVF6upVMSbgvZy8lHZS3CQ)有一位录友问了我这么一个问题。
|
||||
|
@ -1,3 +1,8 @@
|
||||
<p align="center">
|
||||
<a href="https://mp.weixin.qq.com/s/QVF6upVMSbgvZy8lHZS3CQ" target="_blank">
|
||||
<img src="https://code-thinking-1253855093.file.myqcloud.com/pics/20210924105952.png" width="1000"/>
|
||||
</a>
|
||||
|
||||
# 到底要不要读研
|
||||
|
||||
在[知识星球](https://mp.weixin.qq.com/s/QVF6upVMSbgvZy8lHZS3CQ)里讨论了一下关于要不要读研的问题。
|
||||
|
@ -1,3 +1,8 @@
|
||||
<p align="center">
|
||||
<a href="https://mp.weixin.qq.com/s/QVF6upVMSbgvZy8lHZS3CQ" target="_blank">
|
||||
<img src="https://code-thinking-1253855093.file.myqcloud.com/pics/20210924105952.png" width="1000"/>
|
||||
</a>
|
||||
|
||||
# 面试中遇到发散性问题,应该怎么办?
|
||||
|
||||
这周在[知识星球](https://mp.weixin.qq.com/s/QVF6upVMSbgvZy8lHZS3CQ)有一位录友问了我这么一个问题,我感觉挺有代表性的,应该不少录友在面试中不论是社招还是校招都会遇到这一类的问题。
|
||||
|
@ -123,7 +123,7 @@ for (int j = weight[0]; j <= bagWeight; j++) {
|
||||
|
||||
dp[0][j] 和 dp[i][0] 都已经初始化了,那么其他下标应该初始化多少呢?
|
||||
|
||||
其实从递归公式: dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - weight[i]] + value[i]); 可以看出dp[i][j] 是又左上方数值推导出来了,那么 其他下标初始为什么数值都可以,因为都会被覆盖。
|
||||
其实从递归公式: dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - weight[i]] + value[i]); 可以看出dp[i][j] 是由左上方数值推导出来了,那么 其他下标初始为什么数值都可以,因为都会被覆盖。
|
||||
|
||||
**初始-1,初始-2,初始100,都可以!**
|
||||
|
||||
|
Reference in New Issue
Block a user