摘要: 583. 两个字符串的删除操作 class Solution: def minDistance(self, word1: str, word2: str) -> int: n, m = len(word1), len(word2) # dp 数组代表使得 word1 以 i-1 结尾和 word2 阅读全文
posted @ 2023-12-05 17:23 忆象峰飞 阅读(5) 评论(0) 推荐(0) 编辑
摘要: 392.判断子序列 1、双指针 class Solution: def isSubsequence(self, s: str, t: str) -> bool: m, n = len(s), len(t) i, j = 0, 0 while m > i and n > j: if s[i] == t 阅读全文
posted @ 2023-12-05 16:53 忆象峰飞 阅读(8) 评论(0) 推荐(0) 编辑
摘要: 1143.最长公共子序列 class Solution: def longestCommonSubsequence(self, text1: str, text2: str) -> int: m, n = len(text1), len(text2) # dp 数组代表 text1 以 i-1 结尾 阅读全文
posted @ 2023-12-05 15:11 忆象峰飞 阅读(6) 评论(0) 推荐(0) 编辑
点击右上角即可分享
微信分享提示