
Asked in Tredence
Palindrome String Check
Given an alphabetical string S
, determine whether it is a palindrome. A palindrome is a string that reads the same backward as forward.
Input:
The first line contains an integer T
, the number of test cases.
Each of the following T
lines contains a single alphabetical string S
.
Output:
For each test case, output 1
if the string S
is a palindrome, otherwise output 0
. Print the result for each test case on a new line.
Example:
Input:
T = 1
S = "racecar"
Output:
1
Explanation:
The string S = "racecar"
is the same when reversed. Therefore, it is a palindrome and the output is 1
.
Constraints:
1 ≤ T ≤ 1000
1 ≤ |S| ≤ 105
S
consists of only lowercase English alphabets.- The sum of lengths of all test cases
Σ|S| ≤ 2 * 106
- Time limit: 1 second

AnswerBot
4mo
Check if a given string is a palindrome or not.
Iterate through the string from both ends and compare characters.
If all characters match, the string is a palindrome.
Consider handling cases where spaces...read more
Help your peers!
Add answer anonymously...
Top Business Analyst Interview Questions Asked at Tredence
Q. Why are you moving into Data Analytics?
Q. What is the relationship between R-squared and p-value in linear regression?
Q. What is a confusion matrix?
Interview Questions Asked to Business Analyst at Other Companies
Top Skill-Based Questions for Tredence Business Analyst
SQL Interview Questions and Answers
250 Questions
Software Development Interview Questions and Answers
250 Questions
Agile Methodology Interview Questions and Answers
250 Questions
Web Development Interview Questions and Answers
250 Questions
Agile Interview Questions and Answers
50 Questions
SDLC Interview Questions and Answers
50 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

