Write an algorithm to find an palindrome
Answer Posted / nandan_101
boolean isPalindrome(string s){
char[] letters = s.toCharArray() //convert string to
array of characters
int firstCnt = 0 //counter for left side
int secCnt = letters.length - 1 //counter for right
side
while (firstCnt < secCnt){ //work toward middle
if (letters[firstCnt] != letters[secCnt]){
return false //if left and right does not
match, is not a palindrome
}
}
return true //if loop completes without a false, is a
palinrome
}boolean isPalindrome(string s){
char[] letters = s.toCharArray() //convert string
<strong class="highlight">to</strong> array of characters
int firstCnt = 0 //counter for left side
int secCnt = letters.length - 1 //counter for right
side
while (firstCnt < secCnt){ //work toward middle
if (letters[firstCnt] != letters[secCnt]){
return false //if left and right does not
match, is not a <strong
class="highlight">palindrome</strong>
}
}
return true //if loop completes without a false, is a
palinrome
}
Is This Answer Correct ? | 5 Yes | 18 No |
Post New Answer View All Answers
hai friends i did my bcom (distance with out inter)and iam pursuing mca(distance alagappa university)iam learning testing cource in ameerpet can i elgibel for testing jobs pls guide me … …and send details to rangavijetha@gmail.com..thanks
what is the difference between Risk based and Requirement based testing???
which domain is of high demand for software testing, Right now i am working in Education domain .How about demand for Education domain and which companies are recruiting in education domain
Suggest some book to learn more test case???
what is date field test case
send the senario template
What is the Testing strategy for testing client server applications/products?
what is TAS language which is used as a language for some projects/
Any one please can u tell me what is composer? An interviewer asked me do u have experience in Composer? its urgent.
What are the main key components in client and server applications?
What is client server application testing?
What's the difference between system testing and acceptance testing?
when database testing comes into manual tesing
Can you explain the elementary process?
Explain branch coverage and decision coverage.