摘要: https://leetcode.cn/problems/longest-palindromic-subsequence/description/ class Solution { public int longestPalindromeSubseq(String s) { // f[i][j]表示 阅读全文
posted @ 2024-09-11 03:48 风乐 阅读(20) 评论(0) 推荐(0)
摘要: https://leetcode.cn/problems/palindromic-substrings/ 经典题,本题有双指针和dp两种做法,dp的定义是f[i][j]表示s[i:j]是回文串容易联想到递推方程f[i][j]=f[i+1][j-1] && s[i]==s[j]又因为1个字符或者两个相 阅读全文
posted @ 2024-09-11 02:23 风乐 阅读(22) 评论(0) 推荐(0)