Skip to content
LC-0520 Easy LeetCode

520. Detect Capital

Read the full problem statement on LeetCode.
Difficulty: easy Acceptance: 56% Topics: String
View full problem on LeetCode

Reading material

Reference solution (spoiler · python)
# Time:  O(l)
# Space: O(1)

class Solution(object):
    def detectCapitalUse(self, word):
        """
        :type word: str
        :rtype: bool
        """
        return word.isupper() or word.islower() or word.istitle()

Solution from kamyu104/LeetCode-Solutions · MIT