1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-10 18:48:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/有效单词 [valid-word].html
2024-05-16 15:32:41 +08:00

65 lines
2.2 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p><strong>有效单词</strong> 需要满足以下几个条件:</p>
<ul>
<li><strong>至少 </strong>包含 3 个字符。</li>
<li>由数字 0-9 和英文大小写字母组成。(不必包含所有这类字符。)</li>
<li><strong>至少</strong> 包含一个 <strong>元音字母 </strong></li>
<li><strong>至少</strong> 包含一个 <strong>辅音字母 </strong></li>
</ul>
<p>给你一个字符串 <code>word</code> 。如果 <code>word</code> 是一个有效单词,则返回 <code>true</code> ,否则返回 <code>false</code></p>
<p><strong>注意:</strong></p>
<ul>
<li><code>'a'</code><code>'e'</code><code>'i'</code><code>'o'</code><code>'u'</code> 及其大写形式都属于<strong> 元音字母 </strong></li>
<li>英文中的 <strong>辅音字母 </strong>是指那些除元音字母之外的字母。</li>
</ul>
<p>&nbsp;</p>
<p><strong class="example">示例 1</strong></p>
<div class="example-block">
<p><strong>输入:</strong><span class="example-io">word = "234Adas"</span></p>
<p><strong>输出:</strong><span class="example-io">true</span></p>
<p><strong>解释:</strong></p>
<p>这个单词满足所有条件。</p>
</div>
<p><strong class="example">示例 2</strong></p>
<div class="example-block">
<p><strong>输入:</strong><span class="example-io">word = "b3"</span></p>
<p><strong>输出:</strong><span class="example-io">false</span></p>
<p><strong>解释:</strong></p>
<p>这个单词的长度少于 3 且没有包含元音字母。</p>
</div>
<p><strong class="example">示例 3</strong></p>
<div class="example-block">
<p><strong>输入:</strong><span class="example-io">word = "a3$e"</span></p>
<p><strong>输出:</strong><span class="example-io">false</span></p>
<p><strong>解释:</strong></p>
<p>这个单词包含了 <code>'$'</code> 字符且没有包含辅音字母。</p>
</div>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= word.length &lt;= 20</code></li>
<li><code>word</code> 由英文大写和小写字母、数字、<code>'@'</code><code>'#'</code><code>'$'</code> 组成。</li>
</ul>