mirror of
https://github.com/halfrost/LeetCode-Go.git
synced 2025-07-06 17:44:10 +08:00
Update solution 0520
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
# [520. Detect Capital](https://leetcode-cn.com/problems/detect-capital/)
|
||||
# [520. Detect Capital](https://leetcode.com/problems/detect-capital/)
|
||||
|
||||
|
||||
## 题目
|
||||
@ -44,11 +44,13 @@ Output: false
|
||||
|
||||
## 解题思路
|
||||
|
||||
- 把word分别转换为全部小写wLower,全部大写wUpper,首字母大写的字符串wCaptial
|
||||
- 判断word是否等于wLower,wUpper,wCaptial中的一个,如果是返回true,否则返回false
|
||||
- 把 word 分别转换为全部小写 wLower,全部大写 wUpper,首字母大写的字符串 wCaptial
|
||||
- 判断 word 是否等于 wLower, wUpper, wCaptial 中的一个,如果是返回 true,否则返回 false
|
||||
|
||||
## 代码
|
||||
|
||||
```go
|
||||
|
||||
package leetcode
|
||||
|
||||
import "strings"
|
||||
@ -62,4 +64,5 @@ func detectCapitalUse(word string) bool {
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
```
|
Reference in New Issue
Block a user