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 the difference between baseline and traceability matrix?
What different types of manual testing are there?
How will u decide test data to see that evey feature is thoroughly tested
Explain the components of a test plan?
What is difference between V-Model and Agile Model?
What is meant by entry criteria and exit criteria in software testing?
I am a ISTQB cerfity tester with 3 yrs experience(kolkata) , I left my current commpany due to some problem but since two months I did not get new job , why? is my age is 33 yrs and I am married . If anybody have any answer please let me know, my email id sangitadas1981@gmail.com/yahoo.co.in
In interview How do explain in Testcase of Calcuator,Cellphones, Email testing?
What is severity and priority of bug? Give some example.
What is smoke test?
tell me some major and minor defects in ur net banking project?
do we need to write test cases for workflow of the product for instance: there is 2 module "TRAINING ASSIGN MODULE" and "EMPLOYEE" in TRAINING assign MODULE iam assigning training to employee setp is 1.selct traning "oracle" 2.select employee u want assign "peter" 3.apply. now to check whether training assign or not GOTO EMPLOYEE module 1.click on "peter" 2.click on 'view assign to employee'link.now this is a flow do i need to write test cases for this fllow.plz help me guy mail me nirmal_rawatt@rediff.com
What is localization testing (l10n testing)?
How do you determine user soad for a perf test of a Web application?
How can you prepare the resume for testing? Can you send me the answer for this questions?