
Asked in ZIGRAM
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 of the number and decrement the digits to create the largest palindrome less t...read more
Help your peers!
Add answer anonymously...
Top Software Developer Interview Questions Asked at ZIGRAM
Q. Rotting Oranges Problem Statement You are given a grid containing oranges where ...read more
Q. Sort a Stack Problem Statement You are given a stack. Your task is to sort the e...read more
Q. Hourglass Pattern Problem Statement Given an integer 'N', print an hourglass pat...read more
Interview Questions Asked to Software Developer at Other Companies
Top Skill-Based Questions for ZIGRAM Software Developer
Algorithms Interview Questions and Answers
250 Questions
Data Structures Interview Questions and Answers
250 Questions
Web Development Interview Questions and Answers
250 Questions
Java Interview Questions and Answers
250 Questions
SQL Interview Questions and Answers
250 Questions
Software Development Interview Questions and Answers
250 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

