mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-05 15:31:43 +08:00
update
This commit is contained in:
28
leetcode/problem/second-largest-digit-in-a-string.html
Normal file
28
leetcode/problem/second-largest-digit-in-a-string.html
Normal file
@@ -0,0 +1,28 @@
|
||||
<p>Given an alphanumeric string <code>s</code>, return <em>the <strong>second largest</strong> numerical digit that appears in </em><code>s</code><em>, or </em><code>-1</code><em> if it does not exist</em>.</p>
|
||||
|
||||
<p>An <strong>alphanumeric</strong><strong> </strong>string is a string consisting of lowercase English letters and digits.</p>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Example 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> s = "dfa12321afd"
|
||||
<strong>Output:</strong> 2
|
||||
<strong>Explanation:</strong> The digits that appear in s are [1, 2, 3]. The second largest digit is 2.
|
||||
</pre>
|
||||
|
||||
<p><strong>Example 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> s = "abc1111"
|
||||
<strong>Output:</strong> -1
|
||||
<strong>Explanation:</strong> The digits that appear in s are [1]. There is no second largest digit.
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Constraints:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>1 <= s.length <= 500</code></li>
|
||||
<li><code>s</code> consists of only lowercase English letters and/or digits.</li>
|
||||
</ul>
|
Reference in New Issue
Block a user