![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
区间型动态规划
文章平均质量分 91
flyatcmu
这个作者很懒,什么都没留下…
展开
-
区间型动态规划总结
区间型动态规划,都是dp[i][j]由小的区间先计算,然后计算大的区间得到,模板就是: for(int len = 2; len <= n; len++) { for(int i = 0; i + len - 1 < n; i++) { int j = i + len - 1; 很多题都可以用这个模板写; Longest Palindromic Subsequence思路:区间型动态规划,f[i][j]表示s[i] ~ s[j]之...原创 2020-09-05 10:01:53 · 1275 阅读 · 0 评论 -
Longest Palindromic Subsequence
Given a string s, find the longest palindromic subsequence's length in s. You may assume that the maximum length of s is1000. Example Example1 Input: "bbbab" Output: 4 Explanation: One possible l...原创 2019-12-19 12:33:42 · 334 阅读 · 0 评论 -
Longest Palindromic Substring
Given a string S, find the longest palindromic substring in S. You may assume that the maximum length ofS is 1000, and there exists one unique longest palindromic substring. 思路:Palindrome分奇数和偶数个,像aba...原创 2014-02-04 13:13:39 · 613 阅读 · 0 评论 -
Predict the Winner
Given an array of scores that are non-negative integers. Player 1 picks one of the numbers from either end of the array followed by the player 2 and then player 1 and so on. Each time a player picks a number, that number will not be available for the next原创 2020-06-11 04:03:45 · 193 阅读 · 0 评论 -
[leetcode] Stone Game
Alex and Lee play a game with piles of stones. There are an even number ofpilesarranged in a row, and each pile has a positive integer number of stonespiles[i]. The objective of the game is to end with the moststones. The total number of stones is o...原创 2020-06-11 03:30:17 · 299 阅读 · 0 评论