随笔分类 - 动态规划
摘要:https://leetcode.com/problems/distinct-subsequences/ Given a string S and a string T, count the number of distinct subsequences of T in S. A subsequen
阅读全文
摘要:https://leetcode.com/problems/interleaving-string/ Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2. For example,Given:s1
阅读全文
摘要:最长公共子序列不要求连续,最长公共子串要求连续。 参考:http://www.cnblogs.com/huangxincheng/archive/2012/11/11/2764625.html http://www.cnblogs.com/en-heng/p/3963803.html 在最长公共子序
阅读全文
摘要:很经典的一道题,最长回文子串,有多种方法。 首先介绍的一种方法是从中间向两边展开。注意区分aba和abba型的回文串;如果当前最长的子串已经当于两边中最长的子串了,则无需再去判断。 //从中间向两边展开 string expandAroundCenter(string s, int c1, int
阅读全文