Solution: Largest Odd Number in String
Explore how to determine the largest odd-valued integer substring within a large numeric string by scanning from the end. This lesson guides you through using a greedy technique to identify the rightmost odd digit and form the largest odd substring, while analyzing time and space complexity for optimal performance.
We'll cover the following...
We'll cover the following...
Statement
You are given a string, num, which represents a large integer. Your task is to find the largest odd-valued integer that can be formed as a non-empty substring of num. Return this odd integer as a string. If no odd integer exists, return an empty string ("").
Note: A substring is a continuous sequence of characters within a string.
Constraints:
num.length...