Make Palindrome Problem Statement
You are provided with a string STR
of length N
comprising lowercase English alphabet letters. Your task is to determine and return the minimum number of characters that need to be added at the beginning of the string to make it a palindrome.
Input:
The first line contains an integer 'T' indicating the number of test cases. Each test case is given in a single line containing the string STR
.
Output:
For each test case, output the minimum number of characters required to make the string a palindrome, each on a new line.
Example:
Input:
T = 2
STR = "deed"
STR = "aabaaca"
Output:
0
2
Constraints:
1 <= T <= 100
1 <= N <= 5000
STR
contains only lowercase English letters.- Time limit: 1 second
Note:
Implementation should focus on determining the function to calculate the required number without outputting results directly.

AnswerBot
4mo
The task is to determine the minimum number of characters needed at the beginning of a string to make it a palindrome.
Iterate from both ends of the string and compare characters to find the number of ...read more
Help your peers!
Add answer anonymously...
Top SDE-2 Interview Questions Asked at Zoho
Q. You are given a rectangular container filled with 1 liter of liquid. How can you...read more
Q. Wildcard Pattern Matching Problem Statement Implement a wildcard pattern matchin...read more
Q. What is BCNF and why is it important in database management systems?
Interview Questions Asked to SDE-2 at Other Companies
Top Skill-Based Questions for Zoho SDE-2
Algorithms Interview Questions and Answers
250 Questions
Data Structures Interview Questions and Answers
250 Questions
System Design Interview Questions and Answers
250 Questions
Web Development Interview Questions and Answers
250 Questions
Operating Systems Interview Questions and Answers
250 Questions
Java 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

