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 a defect and a failure?
What is the Myers Boundary Table?
What is Functinal Equivalent Test?
Test case's for a window having 4 button's addition, subdtraction, multiplication,division of two numbers having two no range(0,10000) and result box having range between (100,100000).
Who will excatly assign the priority to the bug.. ...
what is a bad defect and why do we write bad defects?
Integraton testing
This question has been asked in my recent inerview with Adithya Birla Group.When to prepare System test plan after getting build or before getting build?
What is the difference between Shakeout, Smoke, and Sanity Testing.
What is the general testing process?
What are the different Testing methodologies?
what are the things we consider when perform the UI testing of any web application please suggest me with basic things?