算法系列(10)LeetCode520 Detect Capital
来源:互联网 发布:c语言程序源代码 编辑:程序博客网 时间:2024/06/08 07:09
嘿嘿,刷题刷个520~~
Given a word, you need to judge whether the usage of capitals in it is right or not.
We define the usage of capitals in a word to be right when one of the following cases holds:
- All letters in this word are capitals, like "USA".
- All letters in this word are not capitals, like "leetcode".
- Only the first letter in this word is capital if it has more than one letter, like "Google".
Input: "USA"Output: True
Input: "FlaG"Output: False
/** * @param {string} word * @return {boolean} */var detectCapitalUse = function(word) { var regExp1 = /^[A-Z]*$/; var regExp2 = /^[a-z]*$/; var regExp3 = /^[A-Z]{1}[a-z]*$/; return (regExp1.test(word)||regExp2.test(word)||regExp3.test(word))};
阅读全文
0 0
- 算法系列(10)LeetCode520 Detect Capital
- leetcode520: Detect Capital
- leetcode520. Detect Capital
- LeetCode520—Detect Capital
- leetcode520. Detect Capital
- LeetCode520. Detect Capital--检测单词的大写字母是否符合规范
- leetcode520 Detect Captical Java
- 520. Detect Capital(C++)
- Detect Capital
- Detect Capital
- Detect Capital
- Detect Capital
- Detect Capital
- Detect Capital
- Detect Capital
- 2017算法课.07(Detect Capital)
- LeetCode 520. Detect Capital (字符串)
- LeetCode 520:Detect Capital (c++)
- 初步了解Junit与assert
- Eclipse 常见设置和报错问题
- HAProxy系列—keepalived+haproxy实现高可用负载层
- reactNative学习笔记之Props属性
- Python 中zip()
- 算法系列(10)LeetCode520 Detect Capital
- update 语句执行十几小时问题解决
- 将解压版的Tomcat作为系统服务启动
- 二阶构造函数
- Javase—集合框架Collection
- spf13安装
- UEFI引导win10+ubuntu16.04双系统,解决“Minimal BASH-like line editing is supported”
- 关于用idea开发配置javaEE项目需要注意的
- mysql外键类型