美文网首页
521. Longest Uncommon Subsequenc

521. Longest Uncommon Subsequenc

作者: 腹黑君 | 来源:发表于2017-09-02 15:31 被阅读0次

Given a group of two strings, you need to find the longest uncommon subsequence of this group of two strings. The longest uncommon subsequence is defined as the longest subsequence of one of these strings and this subsequence should not be any subsequence of the other strings.
如果两者一样,输出-1,好像没有什么说的,就比较大小看谁大呗

    def findLUSlength(self, a, b):
        """
        :type a: str
        :type b: str
        :rtype: int
        """
        if a == b:
            return -1
        else:
            return max(len(a),len(b))

相关文章

网友评论

      本文标题:521. Longest Uncommon Subsequenc

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