摘要: 最长公共子串 和 最长公共子序列 子串必须连续, 子序列不要求连续,次序不变即可 最长公共子串 dp[i][j] 表示以A[i]为结尾的A 的子串 和 以B[j]为结尾的B 的子串的 最长公共子串的长度 初始化: if A[0] == B[0]: dp[0][0] = 1 else: dp[0][0 阅读全文
posted @ 2021-09-15 17:43 pas_a_pas 阅读(64) 评论(0) 推荐(0)
摘要: LC785.判断二分图 LeetCode 785 方法一: BFS + 染色 class Solution: def isBipartite(self, graph: List[List[int]]) -> bool: # BFS from collections import deque n = 阅读全文
posted @ 2021-09-15 11:55 pas_a_pas 阅读(136) 评论(0) 推荐(0)