Next Palindrome Using Same Digits
Try to solve the Next Palindrome Using Same Digits problem.
We'll cover the following
Statement
Given a string num_str
representing a
Consider the following example to understand the expected output for a given numeric string:
input string =
"123321"
possible palindromes =
"213312"
,"231132"
,"312213"
,"132231"
,"321123"
We should return the palindrome
"132231"
as it is greater than"123321"
yet the smallest palindrome excluding the original palindrome.
Constraints:
num.length
num_str
is a palindrome.
Examples
Level up your interview prep. Join Educative to access 70+ hands-on prep courses.