Question: You are given a string S , which consists entirely of decimal digits ( 0 - 9 ) . Using digits from S , create
You are given a string S which consists entirely of decimal digits Using digits from S create a palindromic number with the largest possible decimal value. You should use at least one digit and you can reorder the digits. A palindromic number remains the same when its digits are reversed; for instance, or Any palindromic number you create should not, however, have any leading zeros, such as in or
For example, decimal palindromic numbers that can be created from are: and Among them, has the largest value.
Write a function:
class Solution public String
solutionString S:
that, given a string S of N digits, returns the string representing the palindromic number with the largest value.
Examples:
Given your function should return
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
