找回密码
 立即注册
首页 业界区 科技 算法day38-动态规划(11)

算法day38-动态规划(11)

毁抨句 2025-6-11 14:20:10
目录


  • 最长公共子序列
  • 不相交的线
  • 最大子序和
  • 判断子序列
一、最长公共子序列(不要求元素之间连续)

 https://leetcode.cn/problems/longest-common-subsequence/?envType=problem-list-v2&envId=8At1GmaZ
1.png

 
[code]class Solution {    public int longestCommonSubsequence(String text1, String text2) {        int[][] dp = new int[text1.length()+1][text2.length()+1];        for(int i=1; i
您需要登录后才可以回帖 登录 | 立即注册