Detect capital

December 13, 2022

array-and-hashmap

Problem URL: Detect capital

We can use python's built in fuction to check the conditions.

class Solution:
    def detectCapitalUse(self, word: str) -> bool:
        return word.isupper() or word.islower() or word.istitle()

Time complexity: O(1)
Space complexity: O(1)