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 |
What is the difference between testing Techniques and tools? Give examples
WHAT IS SECURITY TESTING.HOW TO DO SECURITY TESTING.IS THERE ANY FRAMEWORK AVAILABLE
How to Test Web Application Without a Formal Test Plan....?
What is the difference between test case, test suite, test script, test scenario & test plan?
Big Bang Model isn't preferable for higher cost project? a. True b. False (Need the answer urgently) Thanks!
wat is perpose of TRM ?(Test responsibility Matrix)
Hi friends I am kranti completed my IT diploma in 2005 & after that complete my software testing course. Now I am working in small software form as software tester. I have 2 + year experience in manual testing. Now I wan to change company. Plz told me is there any effect that I can not have any degree although I have 2 + experience ?
Hi Please tell me about ERP for hr module what all function u found in hr model .
what is v-model.why you are using v-model?& v-model follow parallelly approach is it correct?
If you're given a program that will average student grades, what kinds of inputs would you use?
How did you go about testing a project?
1. what is a difference between test plan and test strategy?2.What is the test plan is different from the test strategy? then how?