3136. Valid Word Easy
1/**
2 * [3136] Valid Word
3 *
4 * A word is considered valid if:
5 *
6 * It contains a minimum of 3 characters.
7 * It contains only digits (0-9), and English letters (uppercase and lowercase).
8 * It includes at least one vowel.
9 * It includes at least one consonant.
10 *
11 * You are given a string word.
12 * Return true if word is valid, otherwise, return false.
13 * Notes:
14 *
15 * 'a', 'e', 'i', 'o', 'u', and their uppercases are vowels.
16 * A consonant is an English letter that is not a vowel.
17 *
18 *
19 * <strong class="example">Example 1:
20 * <div class="example-block">
21 * Input: <span class="example-io">word = "234Adas"</span>
22 * Output: <span class="example-io">true</span>
23 * Explanation:
24 * This word satisfies the conditions.
25 * </div>
26 * <strong class="example">Example 2:
27 * <div class="example-block">
28 * Input: <span class="example-io">word = "b3"</span>
29 * Output: <span class="example-io">false</span>
30 * Explanation:
31 * The length of this word is fewer than 3, and does not have a vowel.
32 * </div>
33 * <strong class="example">Example 3:
34 * <div class="example-block">
35 * Input: <span class="example-io">word = "a3$e"</span>
36 * Output: <span class="example-io">false</span>
37 * Explanation:
38 * This word contains a '$' character and does not have a consonant.
39 * </div>
40 *
41 * Constraints:
42 *
43 * 1 <= word.length <= 20
44 * word consists of English uppercase and lowercase letters, digits, '@', '#', and '$'.
45 *
46 */
47pub struct Solution {}
48
49// problem: https://leetcode.com/problems/valid-word/
50// discuss: https://leetcode.com/problems/valid-word/discuss/?currentPage=1&orderBy=most_votes&query=
51
52// submission codes start here
53
54impl Solution {
55 pub fn is_valid(word: String) -> bool {
56 false
57 }
58}
59
60// submission codes end
61
62#[cfg(test)]
63mod tests {
64 use super::*;
65
66 #[test]
67 fn test_3136() {
68 }
69}
70
Back
© 2025 bowen.ge All Rights Reserved.