LeetCode
英文官网(推荐)
中文官网
从2016年大二左右开始就接触算法,起初也简单练习过,但现在工作一段时间后,随着代码水平的提高(
自我感觉
),算法水平一直没有进步哈,所以记录下来相关题目,不断练习。
提前说说刷题的心得:
- 只有算法不薄弱才能拿高工资,如果你想当一个nb的程序员,现在开始努力吧 !
- 坚持,积少成多。万事开头难
在题目预览表中,会有题目的编号和题目的难易程度,但是我认为,题目的难易程度并不能真的确定它难还是不难,只是人为对他评价而已,有些难的题确实 Easy。
因为面试中遇到几次都是LeetCode原题,并且是英文题目,题目的
标题
都是LeetCode
英文官网
的链接地址。
题目的编号
是
中文
官网地址。
题目预览表
String
按心情排序,在地铁上看到哪个题目就收藏下来的,然后有时间就做 ! !
# | Title | Difficulty |
718 | Maximum Length of Repeated Subarray | Medium |
583 | Delete Operation for Two Strings | Medium |
678 | Valid Parenthesis String | Medium |
680 | Valid Palindrome II | Easy |
686 | Repeated String Match | Easy |
20 | Valid Parentheses | Easy |
32 | Longest Valid Parentheses | Hard |
3 | Longest Substring Without Repeating Characters | Medium |
300 | Longest Increasing Subsequence | Medium |
673 | Number of Longest Increasing Subsequence | Medium |
718. [Maximum Length of Repeated Subarray
状态转移方程:
dp[i][j]=dp[i-1][j-1]+1
583. Delete Operation for Two Strings
状态转移方程:
dp[i][j]=Math.max(dp[i-1][j],dp[i][j-1])
dp[i][j]=dp[i-1][j-1]+1
678. Valid Parenthesis String
1.利用两个栈分别存储左括号和星星的坐标,防止出现替换后出现
**((*
对坐标进行比较
2.start as left or right, if as left, too low while be ignore to 0 ,right must greater than 0
680. Valid Palindrome II
注意 s.substring(start, end) start保留 end不保留
686. Repeated String Match
do repeat
20. Valid Parentheses
use stack
32. Longest Valid Parentheses
stack push interval position
3. Longest Substring Without Repeating Characters
care for interval and conversion
300. Longest Increasing Subsequence
binary search
673. Number of Longest Increasing Subsequence
一些总结
- StringBuilder 中的
可以将Sb从头开始setLength(0)