digits. Take some of its digits (at least one, each at most once) and arrange them in any order to form a palindromic number, one that reads the same left to right and right to left.
The number must not start with a zero (the number "0" itself is allowed). Return, as a string, the largest palindrome you can build this way.digits="5283582" → '8523258'
There are pairs of 2s, 5s and 8s plus a spare 3: 8523258 uses all seven digits.
digits="0070" → '7'
The palindrome 070 would start with a zero, so the best answer is a lone 7.
digits="1203" → '3'
There are no pairs, so the palindrome is a single digit, and the largest is 3.
digits consists of the digits 0–9 onlydigits="5283582"
'8523258'
Run checks the first 3 tests in your browser. Submit checks all 53 tests on the server, hidden ones included.