回文字符串是一类常见的题目,首先我们要区分两个概念:
- 回文子串(palindromic substring),要求某个字符串s的连续的一个子串$s[i…j]$是回文串;
- 回文子序列(palindromic subsequence),不要求连续性,是通过对于字符串进行删减得到的序列,$s[i],s[j],s[k],j - i >= 1$满足回文性质。
回文字符串是一类常见的题目,首先我们要区分两个概念:
Currently, there are TOO many questions in the leetcode, it is impossible and unnecessary to finish all the questions. Then, how can we select some classic problems?
区间动态规划是很重要的一种动态规划类别,对于这种问题,要仔细分析理解题意,建立从小区间构造大区间的方法。下面我们以几个leetcode上面的题目为例给出分析思路和解析。在所有这些题目中,有一点往往是一样的:我们一般都是对最终的结果建立dp数组,也就是dp中的单个元素往往表示的是给定区间内的最优解,这一点在思考dp问题的时候尤为重要。
最长递增子序列(Longest Increasing Subsequence, LIS)属于最基本也是最经典的动态规划问题,下面我们将以一道LeetCode上面的题目对这个问题进行解析和求解。
最长公共子序列(Longest Common Subsequence, LCS)属于最基本也是最经典的动态规划问题,下面我们将以一道LeetCode上面的题目对这个问题进行解析和求解。
I have used (neo)vim for many years. I think it greatly improved my work efficiency. And I want to share my configure with others to make more people can benefit from the (neo)vim.
As you may have noticed, I use (neo)vim to denote the vim. That is because I have switched to the neovim several months ago. I don’t want to compare which one is better, both of them are very good editors, and many programmers contributed a lot for them. For me, I switch to the neovim for the following reasons:
背包问题是动态规划的一种,其主要的分类和解法请参考
爬山算法是一种局部择优的方法,采用启发式方法,是对深度优先搜索的一种改进,它利用反馈信息帮助生成解的决策。
爬山算法一般存在以下问题: