520. Detect Capital Easy
1/**
2 * [520] Detect Capital
3 *
4 * We define the usage of capitals in a word to be right when one of the following cases holds:
5 *
6 * All letters in this word are capitals, like "USA".
7 * All letters in this word are not capitals, like "leetcode".
8 * Only the first letter in this word is capital, like "Google".
9 *
10 * Given a string word, return true if the usage of capitals in it is right.
11 *
12 * Example 1:
13 * Input: word = "USA"
14 * Output: true
15 * Example 2:
16 * Input: word = "FlaG"
17 * Output: false
18 *
19 * Constraints:
20 *
21 * 1 <= word.length <= 100
22 * word consists of lowercase and uppercase English letters.
23 *
24 */
25pub struct Solution {}
26
27// problem: https://leetcode.com/problems/detect-capital/
28// discuss: https://leetcode.com/problems/detect-capital/discuss/?currentPage=1&orderBy=most_votes&query=
29
30// submission codes start here
31
32impl Solution {
33 pub fn detect_capital_use(word: String) -> bool {
34 false
35 }
36}
37
38// submission codes end
39
40#[cfg(test)]
41mod tests {
42 use super::*;
43
44 #[test]
45 fn test_520() {
46 }
47}
48
Back
© 2025 bowen.ge All Rights Reserved.