美文网首页
14. 最长公共前缀

14. 最长公共前缀

作者: 潇湘demi | 来源:发表于2020-06-12 11:36 被阅读0次

def find_com_str(l):

    m =max(l)

    n =min(l)

    print max(l)

    if len(l) ==0:

    return ""

       le1 =len(n)

    for iin range(le1):

    if m[i] != n[i]:

        return m[0:i]

if __name__ =='__main__':

    l = ["fw1lwer","fw1low","fw1lwight"]

    print find_com_str(l)

相关文章

  • 14. 最长公共前缀

    20180923-摘抄自14. 最长公共前缀 编写一个函数来查找字符串数组中的最长公共前缀。 如果不存在公共前缀,...

  • 算法第3天:最长公共前缀

    leetcode 14. 最长公共前缀 simple 编写一个函数来查找字符串数组中的最长公共前缀。如果不存在公共...

  • [day4] [LeetCode] [title14,122]

    14.最长公共前缀 编写一个函数来查找字符串数组中的最长公共前缀。 如果不存在公共前缀,返回空字符串""。 示例 ...

  • 14. 最长公共前缀

    14. 最长公共前缀 编写一个函数来查找字符串数组中的最长公共前缀。如果不存在公共前缀,返回空字符串 ""。 说明...

  • 14.最长公共前缀

    14.最长公共前缀 难度:简单 编写一个函数来查找字符串数组中的最长公共前缀。 如果不存在公共前缀,返回空字符串 ...

  • 14. 最长公共前缀

    14.最长公共前缀 编写一个函数来查找字符串数组中的最长公共前缀。 如果不存在公共前缀,返回空字符串""。 示例1...

  • [LeetCode]14-最长公共前缀

    14. 最长公共前缀编写一个函数来查找字符串数组中的最长公共前缀。如果不存在公共前缀,返回空字符串 ""。例1:输...

  • 每日Leetcode—算法(2)

    14.最长公共前缀 输入: ["flower","flow","flight"],输出: "fl"输入: ["do...

  • 14. 最长公共前缀

    14. 最长公共前缀[https://leetcode-cn.com/problems/longest-commo...

  • LeetCode学习计划:LeetCode 75-Level-2

    14. 最长公共前缀[https://leetcode.cn/problems/longest-common-pr...

网友评论

      本文标题:14. 最长公共前缀

      本文链接:https://www.haomeiwen.com/subject/iljgtktx.html