521. Longest Uncommon Subsequenc

2017-09-02  本文已影响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))
上一篇 下一篇

猜你喜欢

热点阅读