Back to course home
0% completed
Vote For New Content
Simpler solution
Mohammed Dh Abbas
Nov 8, 2024
class Solution: def findLCSLength(self, s1, s2): m = len(s1) + 1 n = len(s2) + 1 table = [[0] * n for _ in range(m)] for i in range(1, m): for j in range(1, n): if s1[i - 1] == s2[j - 1]: table[i][j] = table[i - 1][j - 1] + 1 else: table[i][j] = max(table[i][j - 1], table[i - 1][j]) return table[-1][-1]
0
0
Comments
Comments
On this page