Skip to content

Commit 761469a

Browse files
committed
add: leetcode 0520 solution
1 parent df54373 commit 761469a

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package leetcode
2+
3+
import "strings"
4+
5+
func detectCapitalUse(word string) bool {
6+
wLower := strings.ToLower(word)
7+
wUpper := strings.ToUpper(word)
8+
wCaptial := strings.ToUpper(string(word[0])) + strings.ToLower(string(word[1:]))
9+
if wCaptial == word || wLower == word || wUpper == word {
10+
return true
11+
}
12+
return false
13+
}

0 commit comments

Comments
 (0)