当前位置:首页 > 编程笔记 > 正文
已解决

Leetcode——字符

来自网友在路上 152852提问 提问时间:2023-10-25 02:30:38阅读次数: 52

最佳答案 问答题库528位专家为你答疑解惑

520. 检测大写字母

在这里插入图片描述

class Solution {
public:bool detectCapitalUse(string word) {int big = 0, small = 0, len = word.length();for (int i = 0; i < len; i++) {if (word[i] >= 65 && word[i] <= 90) {big++;}else {small++;}}if (big == len || small == len) {return true;}else if (len > 1 && big == 1) {if (word[0] <= 90) {return true;}else {return false;}}else {return false;}}
};
查看全文

99%的人还看了

猜你感兴趣

版权申明

本文"Leetcode——字符":http://eshow365.cn/6-23812-0.html 内容来自互联网,请自行判断内容的正确性。如有侵权请联系我们,立即删除!