Challenge 3: Check Palindrome
Given a string, check whether or not it is a palindrome.
We'll cover the following
Problem Statement
Write a function that takes a variable testVariable
, which contains a string, and checks whether or not it is a palindrome.
What is a “Palindrome”?
A Palindrome is a string that reads the same backward and forwards. For example , , etc. All strings with length are considered palindromes.
Remember, lower case letters are different from upper case letters, therefore, is not a palindrome.
Input
A variable testVariable
containing a string.
Output
true
if the input string is a palindrome. false
if the string is not a palindrome.
Sample Input
"madam"
Sample Output
true
Try it Yourself
Try this challenge yourself before examining the solution. Good luck!
Level up your interview prep. Join Educative to access 80+ hands-on prep courses.