File tree Expand file tree Collapse file tree 1 file changed +28
-1
lines changed
src/main/java/g1701_1800/s1796_second_largest_digit_in_a_string Expand file tree Collapse file tree 1 file changed +28
-1
lines changed Original file line number Diff line number Diff line change 1- 1796\.
1+ 1796\. Second Largest Digit in a String
2+
3+ Easy
4+
5+ Given an alphanumeric string ` s ` , return _ the ** second largest** numerical digit that appears in_ ` s ` _ , or_ ` -1 ` _ if it does not exist_ .
6+
7+ An ** alphanumeric** string is a string consisting of lowercase English letters and digits.
8+
9+ ** Example 1:**
10+
11+ ** Input:** s = "dfa12321afd"
12+
13+ ** Output:** 2
14+
15+ ** Explanation:** The digits that appear in s are [ 1, 2, 3] . The second largest digit is 2.
16+
17+ ** Example 2:**
18+
19+ ** Input:** s = "abc1111"
20+
21+ ** Output:** -1
22+
23+ ** Explanation:** The digits that appear in s are [ 1] . There is no second largest digit.
24+
25+ ** Constraints:**
26+
27+ * ` 1 <= s.length <= 500 `
28+ * ` s ` consists of only lowercase English letters and/or digits.
You can’t perform that action at this time.
0 commit comments