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 |
give me some interview ques?
hi!!!!!!!!!!!! i heard there is a new type of testing i.e. YELLOW TESTING if anyone knows about it plz tell me. thanks
how would we do the encryption and decryption testing
What all types of testing you will do for banking website?
On login window for username and password auto populated field means what !
Is a "A fast database retrieval rate" a testable requirement?
What is TEST PLAN, TEST STRATEGY, TEST SCENARIO, TEST CASE, TEST SCRIPT? can any body give me definition with example.
1.How to maintain the Bug status Report? 2.What is project based Company and product based company?
1)Asked to write test cases on Print option in a MS word application 2 Give scenarios for the following: throw a ball into bucket full of water and write scenarios so that water does not spill out. Explain test stratergy. What is localization. What do u test in localization?
what is exit criteria and entry criteria with proper examples??? hi, i faced so many interwies in this question...so plz answer this questions as early as possible...
What are the non functional requirements?
Anyone give me the Test Scenario template.