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
Hi to all, im vaibhav i joined a MNC as a tester and i got a banking (HSBC) project can any one tell me as a fresher what kind of strategy i sholud use to perform better. thanx
Describe Testing Decomposition?
What is bug, deffect, issue, error?
Write the test cases for file transfer from one user to other from Google Drive/drop box?
Write a Test scenario for Outlook Search functionality.
What does 100% statement coverage mean?
write the test senario on opening door in the flow diagram format
what is the test plan of facebook?
What is agile testing and why is it important?
is it possible web application make it as executable file
What is known as data-driven testing?
Why it is recommended to add verification checks to your all your scenarios?
what is the difference between Desktop testing,Client/server testing and webapplication testing
hi, this is geetha, i have one doubt regarding the vulnerability testing. For sql injection testing is there any need for the tools to be installed. If it is what is tool and what is the method to test in sql injection testing. Plz Guide me
Encapsulation of attributes and operations inside objects makes it easy to obtain object state information during testing. is it true.explain