MCPcopy Create free account
hub / github.com/HuberTRoy/leetCode / detectCapitalUse

Method detectCapitalUse

String/DetectCapital.py:47–61  ·  view source on GitHub ↗

:type word: str :rtype: bool

(self, word)

Source from the content-addressed store, hash-verified

45
46class Solution(object):
47 def detectCapitalUse(self, word):
48 """
49 :type word: str
50 :rtype: bool
51 """
52 if len(word) < 2:
53 return True
54
55 letter_one = ord(word[0])
56 # letter_two = word[1]
57 if 65 <= letter_one <= 90:
58 return self.letter_all_capital_or_lower(word[1:])
59
60 return self.letter_all_lower(word[1:])
61 # for i in word:
62
63 def letter_all_capital_or_lower(self, word):
64 #

Callers

nothing calls this directly

Calls 2

letter_all_lowerMethod · 0.95

Tested by

no test coverage detected