Next Smaller Palindrome Problem Statement
You are given a palindrome number represented as a string S
. Your task is to find the largest palindrome number that is strictly less than S
.
Example:
Input:
T = 2
S1 = "12321"
S2 = "98789"
Output:
"12221"
"98689"
Explanation:
For S1 = "12321"
, the largest palindrome less than it is "12221"
.
For S2 = "98789"
, the largest palindrome less than it is "98689"
.
Constraints:
1 ≤ T ≤ 100
1 ≤ |S| ≤ 104
, where |S| denotes the size of string 'S'.

AnswerBot
4mo
Find the largest palindrome number strictly less than a given palindrome number.
Iterate from the middle towards the start and end of the string to find the largest palindrome less than the given numbe...read more
Help your peers!
Add answer anonymously...
Deutsche Bank Software Developer Intern interview questions & answers
A Software Developer Intern was asked Q. Query and Matrix Problem Statement You are given a binary matrix with 'M' rows a...read more
A Software Developer Intern was asked Q. Jump Game Problem Statement In this problem, you are given an array ARR consisti...read more
A Software Developer Intern was asked Q. Dijkstra's Shortest Path Problem Given an undirected graph with ‘V’ vertices (la...read more
Popular interview questions of Software Developer Intern
A Software Developer Intern was asked Q1. Query and Matrix Problem Statement You are given a binary matrix with 'M' rows a...read more
A Software Developer Intern was asked Q2. Jump Game Problem Statement In this problem, you are given an array ARR consisti...read more
A Software Developer Intern was asked Q3. Dijkstra's Shortest Path Problem Given an undirected graph with ‘V’ vertices (la...read more
>
Deutsche Bank Software Developer Intern Interview Questions
Stay ahead in your career. Get AmbitionBox app


Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+
Reviews
10L+
Interviews
4 Cr+
Salaries
1.5 Cr+
Users
Contribute to help millions
AmbitionBox Awards
Get AmbitionBox app

