[LintCode]Longest Common Substring(Python)
来源:互联网 发布:同济大学软件学院电话 编辑:程序博客网 时间:2024/06/09 17:32
class Solution: # @param A, B: Two string. # @return: the length of the longest common substring. def longestCommonSubstring(self, A, B): # write your code here maxlength = len(A) + 1 for i in range(maxlength)[::-1]: substrB = [] for j in range(len(B) + 1 - i): substrB.append(B[j: j + i]) for str in substrB: if A.find(str) != -1: return i return 0
阅读全文
0 0
- [LintCode]Longest Common Substring(Python)
- Lintcode - Longest common substring
- lintcode:Longest Common Substring
- [LintCode]Longest Common Prefix(Python)
- [Lintcode]Longest Common Substring最长公共子串
- LintCode之最长公共子串(Longest Common Substring)
- Lintcode - Longest common subsequence
- lintcode: Longest Common Prefix
- Longest common substring
- spoj1811 Longest Common Substring
- Longest Common Substring
- Longest common subsequence / substring
- HDU1403 Longest Common Substring
- longest common substring
- Longest Common Substring
- [刷题]Longest Common Substring
- longest-common-substring
- Longest Common Substring
- HDU Pots
- 生产消费
- uva 307 bfs优化剪枝
- spark RDD详解及源码分析
- spring framework中的自动装配和自动检测
- [LintCode]Longest Common Substring(Python)
- 排序整理
- js 判断时间不能超过3个月
- GUI
- 垃圾收集算法
- ubuntn 17.04 使用总结
- scala中的隐式转换、隐式参数和隐式类
- sass变量
- 贪心,递归,动态规划,及分治算法之间的区别和联系