Practice Largest Odd Number in String
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
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.
Source: Largest Odd Number in String on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
num = "52"
Output
"5"
# Example 2
Input
num = "4206"
Output
""
# Example 3
Input
num = "35427"
Output
"35427"
Constraints
1 <= num.length <= 10^5
num only consists of digits and does not contain any leading zeros.
Related LeetCode Problems
Practice more problems similar to Largest Odd Number in String.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.