You are given a string num representing a large integer. Return the largest-valued odd integer (as a string) that is a non-empty substring of num, or an empty string "" if no odd integer exists. A substring is a contiguous sequence of characters within a string.
You are given a string num representing a large integer. Return the largest-valued odd integer (as a string) that is a non-empty substring of num, or an empty string "" if no odd integer exists. A substring is a contiguous sequence of characters within a string.
Example 1:
Input: {"num":"52"}
Output: 5
Constraints:
1≤num.length≤105
num only consists of digits and does not contain any leading zeros.
Test Cases
Input (Stdin)
Expected Output (Stdout)
Execution Result
Run code to see results.
Input
arr ={"num":"52"}
num has 2 digits. We want the largest odd number that appears as a contiguous piece of it.