Write an algorithm to find an palindrome

Answers were Sorted based on User's Feedback



Write an algorithm to find an palindrome..

Answer / sagai

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
}
firstCnt++
secCnt--
}
return true //if loop completes without a false, is a
palinrome
}

Is This Answer Correct ?    20 Yes 9 No

Write an algorithm to find an palindrome..

Answer / 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

More Manual Testing Interview Questions

what is difference between black box and white box testing? In most of the companies which tecnique is used

6 Answers  


What are the contents in "Requirements Traceability Matrix" not in " Test Responsibility Matrix"?

7 Answers   EDS,


How will you select the regression test case?

5 Answers   Cognizant, HSBC,


Nowadays Product based testing is done is almost all companies. What does a "Product" actually means.

3 Answers  


Hi , Please send me the interview questions which were asked in manual testing mainly the test cases asked to write in interview.

0 Answers  


Do you write test cases for regression testing?

20 Answers   Hexaware,


if we ve 1000 test cases to run and we ve no time and we dnt wanna use automation tool how we will complete testing in time constrant plz do answer

7 Answers   Nexus Technologies,


Test cases for Equity,Bond,Futures and options financial instruments

1 Answers   NIIT,


What is Back End testing?

4 Answers   Virtusa,


How should I manage the test cases? Should I have to write Version/Build number in the test cases against test cases which is get modified for that build/version.

3 Answers  


what is the difference b/w Priorty and severity in Bug Report

5 Answers   TCS,


What is mutation testing?? And when we use it??

2 Answers   IBM,


Categories