A palindrome is a string that reads the same forwards and backwards (e.g., 'madam'). To check if a string is a palindrome, convert it to a character array, then use a loop to compare characters from the beginning and end moving toward the center. If any mismatch is found, the string is not a palindrome. The algorithm runs in O(n) time complexity and O(n) space complexity for the character array.
Deep Dive
Prerequisite Knowledge
- No data available.
Where to go next
- No data available.
Deep Dive
I Was Asked This Question 3 Times in SDET Interviews!Added:
Welcome everyone to our coding challenges interview questions.
So, most of our coding challenges in this session, especially in this playlist, has been asked in the interview for SDET and QA automation. So, I sorted out here 30 to 25 questions that had been encountered last 15 years when I faced the interviews. So, I hope these 30 challenges, coding challenges, are enough for any coding interviews for senior-level SDET or mid-level SDET or QA automation. So, today I'm going to discuss I will I will be solving one question that was actually asked three times last year when I was in the market. So, that seems like very important, and I also got this is the this problem is very frequently asked from interviewer to SDET engineer. So, let's start. So, today's issue, let me write it.
So, let me create a class fast, and this is very important. Remember, this is five-star coding issue. If you have five interviews, this problem, this coding issue, you will get you will get from one of these interviewers. So, uh uh be focused and try to understand and practice by yourself. So, let me create a class fast.
>> [snorts] >> And hear one thing. I am writing most of coding challenges in Java because in interview nobody will ask you for a specific language. They just give you the problem and ask you write it using your favorite language. So mostly Java uh uh interviewer prefer Java and you can pick Java. If you don't don't know Java, but if you don't like Java, you can write it in any other language. Logic is the same. You can use Python or you can use JavaScript also.
So I'm writing it in Java.
So write it down.
Okay. I just write the file name ball problem.
Here [clears throat] issue is the the issue we need to solve is here. I'm writing it down.
It is actually how to check if a string is palindrome.
What does it mean?
Palindrome means uh there are some words in English like one of these. As example, we can say mhm Excuse me.
Madam.
So, palindrome word means or a string means if you reverse a word or a string, it would be the same. Suppose, I have madam as input.
And if I reverse madam, the output will be also madam, right?
The output will be also madam.
M like M from the end, M A D A M. M A D A M. So, palindrome word or a string means if you reverse a word, the word would be the same.
You understand like madam whatever you need to find. You can Google it. You will get the list of palindrome words. So, how you can solve it?
Now, I create the class already.
So, inside class, let's write the main method.
Okay.
Inside main method, write the logic.
First, take a string. I'm just solving it how you solve it in the interview.
So, in interview, you don't have that much time. So, take a palindrome word as a input like a string S or they will give you a word, palindrome word.
Okay.
So, madam is our input. We have to check whether madam is palindrome or not.
So, now uh create a flag or boolean variables, boolean is palindrome equals true.
That is our flag.
So, now create a array, char array.
character array.
So, c, I hope you guys know those things already.
c equals to s s t dot to character array. So, now what will happening?
So, all those uh uh letters in madam will be storing in a array. And this array is character type.
Okay.
Then what you will do?
Find the length of the array.
c [snorts] dot length.
Now we'll get the length of array. So, the length of array is what? 1 2 3 4 5.
So, length of the array will be 5.
Okay.
So, now uh create a loop for So, loop will be running in I equal to zero.
Zero is fine.
Then I smaller than equal to M and divided by two.
It's fine.
And I increment I plus plus. So, where to because if we If we check half of this array like until here, so it will be we don't need to, you know, we don't need to check more than half of this array elements.
So, then you need if Okay, in that two and two and two two okay, fine. Then you need if Then if what you will do in if, you will check C I the first element of the array C I not equals to C N minus one minus zero.
Sorry, minus I.
Okay.
Then what will happen?
is It's pal equals to false.
Then, break.
Okay, what is happening here?
>> [clears throat] >> Uh we are going through letter by letter in this array.
And we are checking the first element. Like here, our array is like this. Just for your understanding, I'm writing it.
Our array will be like this. And first element will be A means that array.
Then, it will be A.
It will be D.
It will be A. It will be M.
So, first element, it is index zero.
So, I equal to zero, then C I. C I means M. So, M is not equal to the last element. Then, last element means what?
C N means array length.
Array length is five.
So, one two to N is five. So, here zero one two three four. So, M is in the four index. That's why we have to put minus one. So, N is five minus one means four. Index four M.
N minus one. Here minus Sorry, minus I.
Minus I is zero. That means four.
This is four. Index four. So, first index and last index, if last first in in index and last index is not equal, then it is not palindrome.
So, we can change the value of our flag is pal equal to false and we can break.
We don't need to check anymore. And this loop will be going through. It will be checking one by one. Next one will be A and A. There it will be comparing A and A. Then last next one will be uh half, right? Half by five means two. So, it will be checking this two. It's fine.
This two and this two. So, D is in the middle. So, you don't need to check it automatically.
So, now uh a break. So, if uh first element and last element is equal uh equal, then what will happening? Then we'll be writing here. The if it is uh not equal, then it will be break. If it is equal, then it is palindrome, right?
system println So, is pal.
is Why it is red? Because pal is about printing is pal. So, that means that we'll be uh printing the flag value. So, if first element and last element is not equal to flag value is false. So, here palindrome will be false. If it is equal first element last element, then this element this element, uh it will be uh true.
Uh is palindrome be true because value is not changing for is palindrome. So, the is palindrome value will be printing here. That's it.
So, let's see. Run it.
So, let me run it.
You see?
Palindrome is true. Palindrome is true.
Why it is two times?
Mhm.
Yeah, because it is two time I make a silly mistake. It should be here.
It should be here because it should be outside for loop.
Now, run it.
You see?
It's true.
Now, check with another word like like future.
Is it palindrome? No, right? So, right.
Run it.
Yeah, false.
You see?
So, that's it.
Try to understand it and practice. And it is very important uh interview question.
Uh definitely you will get it if you have five, six interview, you will get this issue.
Uh and another thing, here we use very basic programming logic like for loop, if, if else, array length, then a string, then boolean, all of the stuff, right? So, if you don't have knowledge for basic programming, so you can visit our site or here is two site is very helpful. I'm just giving you you can go here.
Search it.
If solution academy.
So, if you go our YouTube channel.
Here is complete estate course you will get full estate estate course. You will get all uh videos comprehensive live class live class videos uh from A to Z here.
And also also here is our Java Java class, basic Java from here to here.
All Java related things like loop, loops, then uh variables, data type, then Java introduction basic, then Java data structure array Java data structure array list, set, map Java method, everything is here Java related. Uh till intermediate level so that estate and automation engineers uh can get help actually get everything what they will need in your job. And here I have one video that is very important class object constructor.
Uh if you don't have clear view clear view uh about class and object, so definitely our oops concept, if you don't know the oops concept confidently, you must have to watch this one. And I will be recommending to watch this video. This one video will be solved actually giving you a comprehensive knowledge for oops, object-oriented programming.
And another important thing, if you go here, just a minute, if you go here, if you are a little bit advanced, try to watch this video and here are lots of things and all are actually industrial level. What I have done previously in my project, I implemented these things as a industry level framework which I actually created from from scratch. So, try to watch it if you want to be a automation architect or automation developer or estate or test test developer engineer, whatever.
You will get the industry level real framework flavor. It is not a tutorial, it is actually we build real framework here. And exactly you will get the same thing in your company if you get job or if they don't have any framework, you can follow these steps from the beginning and later I will provide a framework universal framework so that you can copy and paste in your real project and you can modify it. So, I'm working on it.
Soon I will it will be available. So, until then, thank you so much and good luck if you looking for a state job or QA automation. Hopefully, this video will be very helpful to you. Thank you so much. Bye.
Related Videos
Agentforce NOW AMA: Build with React and Salesforce Multi-Framework
SalesforceDevs
490 views•2026-05-28
How agent o11y differs from traditional o11y — Phil Hetzel, Braintrust
aiDotEngineer
450 views•2026-05-28
WEB TECHNOLOGIES UNIT-2 | Degree 4th sem BCOM Computers web technologies unit-2 full explanation💯✅
LearnwithSahera
1K views•2026-05-29
More tests are always better? How to use AI to identify tests that bring little value
Alliance4Qualification
335 views•2026-05-29
Search Algorithms Explained in 60 Seconds! 🤖💨
samarthtuliofficial
218 views•2026-06-01
People of Game of Thrones using JavaScript DOM
AltCampus
296 views•2026-05-30
Introduction to Problem Solving Part - 1 | Lecture 1 | Intermediate DSA
ascensionix
107 views•2026-05-29
🚀 BCS613C Compiler Design | Module 1 to 5 Schema Evaluation 🔥 | VTU 6th Sem 💯 #VTU #bcs613c #exam
Pranavaa-y4y
104 views•2026-06-02











