![](https://img-blog.csdnimg.cn/20210521230625558.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
动态规划
dp
zing_2
行云流水,任意所致
展开
-
最长有效括号-动态规划
leetcode题解 题目描述 class Solution { public int longestValidParentheses(String s) { int len=s.length(); if(len==0){ return 0; } int[] dp=new int[len]; dp[0]=0; for(int i=1;i<len;i++){原创 2021-05-25 11:36:49 · 76 阅读 · 0 评论 -
正则表达式匹配-动态规划
https://leetcode-cn.com/problems/regular-expression-matching/solution/zheng-ze-biao-da-shi-pi-pei-by-leetcode-solution/ class Solution { public boolean isMatch(String s, String p) { int m=s.length();int n=p.length(); boolean[][] dp=new.原创 2021-05-24 12:43:59 · 78 阅读 · 0 评论 -
最长回文子串
给你一个字符串 s,找到 s 中最长的回文子串 给你一个字符串 s,找到 s 中最长的回文子串。 示例 1: 输入:s = “babad” 输出:“bab” 解释:“aba” 同样是符合题意的答案。 示例 2: 输入:s = “cbbd” 输出:“bb” 示例 3: 输入:s = “a” 输出:“a” public class Solution { public String longestPalindrome(String s) { int len=s.length原创 2021-05-21 23:16:10 · 53 阅读 · 0 评论