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
What is an entry criteria?
What is your daily process? I have 2+EXP IN MANUAL TESTING.PLEASE SUGGEST ME HOW i ANSWER
what is base time , how can we base time your doc"s ?
Explain Test Plan with example? Explain following in the test plan with examples What is being tested? What are pass/fail criteria? When will each test occur? What Hardware & Software environment is required? What features must be tested? What features will not be tested? What are the responsibilities of individuals & organisation in the project?
What is frame level testing and how do we test it?
How should validation activities be handled?
What is the test harness?
where can i learn domain knowledge? how cab i gain domain knowledge? what types of Questions can be asked in domain(BFSI)? PLZ REPLY ME
consider therez 1 land and it has mango trees in it, what are the tets cases or how will we count no of mangoes on all trees
To specify the test artifacts involved in testing.
ive been looking for a junior tester job for quite some time now, but most company keep requisting for experienced staffs, but if i dont start from somewhere how do i get the experience
What and why is api testing?
hi, I m looking for a career in manual web testing. so PLZ anybody who have the practical knowledge of dis field help me. GIVE ME UR MAIL ID so that i can ask regarding some doubts. my MAIL ID is ankurtester819@gmail.com
what is conditional testing? explain and examples
You have a testing team of 10 members, and now you have to reduce it by 5 member and you dont want to increase risk in your product, you are try to cover all functionality to test. What test Strategy you follow.