digits holding a large number with no leading zeros. You may cut out any contiguous non-empty piece of it and read that piece as a number.
Return the piece that gives the largest odd number, or the empty string "" if no odd number can be formed.
The string can be up to 10⁵ characters long, so converting whole pieces to integers is not a good idea.digits="73804" → '73'
A number is odd when its last digit is odd. The longest piece ending in an odd digit is "73".
digits="2846" → ''
There are no odd digits at all, so the answer is empty.
digits="901" → '901'
digits contains only digitsdigits does not start with a zerodigits="73804"
'73'
Run checks the first 3 tests in your browser. Submit checks all 132 tests on the server, hidden ones included.