Question: please help in python 1. (25 points) A palindrome is a string that reads the same backward as forward. For example, 'madam and test tset
1. (25 points) A palindrome is a string that reads the same backward as forward. For example, 'madam" and "test tset" are palindromes but "banana" is not. Given a string s, write a function canFormPa1indrome(s) that tests whether the letters in s can be permuted to form a palindrome. Note: Your algorithm must use hashing (or dictionary in Python). The time complexity is O(n), where n is the length of the input string. Assume an empty string is a palindrome. Examples: canFormPa1indrome (aamdm) should return True Explanation: "aamdm" can be permuated to "madam", which is a palindrome. canFormPa1indrome (abbddaaa) should return True Explanation: "abbddaaa" can be permuated to "aabddbaa", which is a palindrome. canFormPa1indrome (abcc) should return False
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
