C++ 1-Line Simple, 6ms beats 75%


  • 0
    M
    class Solution {
    public:
        bool detectCapitalUse(string word) {
            return all_of(word.begin(), word.end(), ::isupper) || all_of(word.begin() + 1, word.end(), ::islower);
        }
    };
    

Log in to reply
 

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