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)


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