1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-11 02:58:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/字符串中第二大的数字 [second-largest-digit-in-a-string].html
2022-03-29 12:43:11 +08:00

31 lines
842 B
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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>给你一个混合字符串 <code>s</code> ,请你返回 <code>s</code> 中 <strong>第二大 </strong>的数字,如果不存在第二大的数字,请你返回 <code>-1</code> 。</p>
<p><strong>混合字符串 </strong>由小写英文字母和数字组成。</p>
<p> </p>
<p><strong>示例 1</strong></p>
<pre>
<b>输入:</b>s = "dfa12321afd"
<b>输出:</b>2
<b>解释:</b>出现在 s 中的数字包括 [1, 2, 3] 。第二大的数字是 2 。
</pre>
<p><strong>示例 2</strong></p>
<pre>
<b>输入:</b>s = "abc1111"
<b>输出:</b>-1
<b>解释:</b>出现在 s 中的数字只包含 [1] 。没有第二大的数字。
</pre>
<p> </p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 <= s.length <= 500</code></li>
<li><code>s</code> 只包含小写英文字母和(或)数字。</li>
</ul>