摘要: https://leetcode.cn/problems/edit-distance/ class Solution { public int minDistance(String word1, String word2) { // 经典题编辑距离 // f[i][j]表示word1前i个字符中选择 阅读全文
posted @ 2024-09-10 22:18 风乐 阅读(31) 评论(0) 推荐(0)
摘要: https://leetcode.cn/problems/delete-operation-for-two-strings/solutions/ 两种做法,1.直接dp 2.转换题意,思考成LCS class Solution { public int minDistance(String word 阅读全文
posted @ 2024-09-10 21:43 风乐 阅读(16) 评论(0) 推荐(0)
摘要: https://leetcode.cn/problems/distinct-subsequences/submissions/563375885/ 这题比较有难度,具体不太好想到,需要以是否选择s[i]来划分子集这位描述的很清楚,不做过多赘述 class Solution { public int 阅读全文
posted @ 2024-09-10 16:21 风乐 阅读(9) 评论(0) 推荐(0)