mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-14 03:41:41 +08:00
add leetcode problem-cn part3
This commit is contained in:
29
算法题(国内版)/problem (Chinese)/宝石与石头 [jewels-and-stones].html
Normal file
29
算法题(国内版)/problem (Chinese)/宝石与石头 [jewels-and-stones].html
Normal file
@@ -0,0 +1,29 @@
|
||||
<p> 给你一个字符串 <code>jewels</code> 代表石头中宝石的类型,另有一个字符串 <code>stones</code> 代表你拥有的石头。 <code>stones</code> 中每个字符代表了一种你拥有的石头的类型,你想知道你拥有的石头中有多少是宝石。</p>
|
||||
|
||||
<p>字母区分大小写,因此 <code>"a"</code> 和 <code>"A"</code> 是不同类型的石头。</p>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong>示例 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>输入:</strong>jewels = "aA", stones = "aAAbbbb"
|
||||
<strong>输出:</strong>3
|
||||
</pre>
|
||||
|
||||
<p><strong>示例 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>输入:</strong>jewels = "z", stones = "ZZ"
|
||||
<strong>输出:</strong>0<strong>
|
||||
</strong></pre>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong>提示:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>1 <= jewels.length, stones.length <= 50</code></li>
|
||||
<li><code>jewels</code> 和 <code>stones</code> 仅由英文字母组成</li>
|
||||
<li><code>jewels</code> 中的所有字符都是 <strong>唯一的</strong></li>
|
||||
</ul>
|
Reference in New Issue
Block a user