Python scripts


  • 0
    Y
    class Solution(object):
        def detectCapitalUse(self, word):
    
     
            if len(word) == 1:
                return True
            if len(word) == 2:
                if word[0].isupper():
                    return True
                else:
                    return word[1].islower()
            if len(word) >= 3:
                if word[0].isupper():
                    if word[1].isupper():
                        return word[2:].isupper()
                    else:
                        return word[2:].islower()
                else: 
                    return word.islower()
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.