My python one line solution


  • 0
    X
    def detectCapitalUse(self, word):
         return bool(not any(['A' <= i <= 'Z' for i in word[1:]]) or all(['A' <= i <= 'Z' for i in word]))
    

Log in to reply
 

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