Question:
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" Explanation: The only non-empty substrings are "5", "2", and "52". "5" is the only odd number.
Example 2:文章来源:https://www.toymoban.com/news/detail-688817.html
Input: num = "4206" Output: "" Explanation: There are no odd numbers in "4206".
Example 3:文章来源地址https://www.toymoban.com/news/detail-688817.html
Input: num =
到了这里,关于LeetCode --- 1903. Largest Odd Number in String 解题报告的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!