leetcode

Solution to some Leetcode problems written in C++
git clone git://git.dimitrijedobrota.com/leetcode.git
Log | Files | Refs | README | LICENSE

0520.cpp (265B)


      1 class Solution {
      2   public:
      3     bool detectCapitalUse(string word) {
      4         int count = 0;
      5         for (char &c : word)
      6             count += c == toupper(c);
      7         return count == 0 || count == word.size() || (count == 1 && word[0] == toupper(word[0]));
      8     }
      9 };