Second Largest Digit in a String Problem
Second Largest Digit in a String Problem — ExecCode Easy DSA Practice
Solve the Second Largest Digit in a String problem on ExecCode. Free online easy DSA practice in Hashing. Write and run code in Java, C++, Python — no signup required to run.
Problem description
Description You are given an alphanumeric string s, return the second largest numerical digit that appears in s , or -1 if it does not exist. Your task is to an alphanumeric string is a string consisting of lowercase English letters and digits. Return the required answer exactly as shown in the examples.
Examples
Input {"s": "dfa12321afd"}; Output 2. Input {"s": "abc1111"}; Output -1
Constraints
1 <= s.length <= 500 s consists of only lowercase English letters and digits.
Practice Second Largest Digit in a String free on ExecCode. Browse DSA problems, topic map, and placement guides.