Back to course home
0% completed
Solution: Largest Palindromic Number
Problem Statement
Given a string s
containing 0 to 9 digits, create the largest possible palindromic number using the string characters.
A palindromic number reads the same backward as forward.
If it's not possible to form such a number using all digits of the given string, you can skip some of them.
Examples

 Input: "323211444"
 Expected Output: "432141234"
 Justification: This is the largest palindromic number that can be formed from the given digits.

 Input: "998877"
 Expected Output: "987789"
.....
.....
.....
Like the course? Get enrolled and start learning!