Write an algorithm to find an palindrome
Answers were Sorted based on User's Feedback
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 |
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 |
do you write test cases for adhoc testing?
How will you divide two numbers without using the division operator?
2 Answers Aspire, College School Exams Tests,
what is the difference between section & test feature in test case documention?
What is Test Responsibility Matrix?
7 Answers Landscape Technologies, Wipro,
Hi, Please can one tell me how to test the usability testing, which method has to be used, how to write the report? Thanks Deepa
Give some infos about test track tool?
what type of questions we can ask the interviewer after finishing of the interview?
What are the web designing tools ?
what is SIT? Explain with Example?
Hi Friends, I have 3 years of experience in QA Testing. Are there any opportunities for entry-level tester in MN.
What are the differences and similarities between build and fix model and the v-model??
10.List five words that best describe ur strengths?
1 Answers VJIL Consulting, Wipro,