题解 | #参数解析#

公共子串计算

http://www.nowcoder.com/practice/98dc82c094e043ccb7e0570e5342dd1b

def print_common_strlen(str_short, str_long):
max_com_len = 0
compare_str = ''
i = 0
while i + max_com_len < len(str_short):
#判断目前最大公共子串长度加1是否公共子串
compare_str = str_short[i:i + max_com_len + 1]
#找不到就从下一个字符开始找
if compare_str not in str_long:
compare_str = ''
i += 1
continue
else:
#如果找到了,就是长度加1
max_com_len += 1
print(max_com_len)

str_one = input()
str_two = input()
if len(str_one) < len(str_two):
print_common_strlen(str_one, str_two)
else:
print_common_strlen(str_two, str_one)

全部评论

相关推荐

09-19 19:43
已编辑
广东工业大学 golang
zizi哦:很牛了,稳大厂给几点建议:一、想被稳的问题,关键点,可以加深一点,一眼看过去全是文字,没事干容易抓不住重点;二、第一个开源项目很多人 star,这是一个证明你牛逼的证据,建议放在项目背景,开头就是这句话,背景到结果,并且重点标注;三、个人技能可以放后,没什么把握的可以不写上去,比如你列了这么多微服务中间件,你确定自己真的理解底层吗?如果不熟悉,可以表述为熟悉微服务体系开发,如 xxx 中间件;四、项目很多描述在讲述架构,有没有自己觉得亮点的设计,体现不出你解决问题的过程和思考。
如何写一份好简历
点赞 评论 收藏
分享
09-10 17:13
已编辑
广东技术师范大学 Java
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务