Practice Largest Palindromic Number
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Using some or all digit occurrences from num in any order, form the numerically largest palindrome without leading zeros. At least one digit must be used. Return the result as a string.
Source: Largest Palindromic Number on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
num = "444947137"
Output
"7449447"
# Example 2
Input
num = "00009"
Output
"9"
Constraints
1 <= num.length <= 10^5
num consists of digits.
Related LeetCode Problems
Practice more problems similar to Largest Palindromic Number.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.