DIY: Valid Palindrome

Solve the interview question "Valid Palindrome" in this lesson.

Problem statement

Write a function that takes a variable containing a string, and check whether it is a palindrome or not.

Input

The input will contain a string s. The following two are example inputs to the function:

"bccd"
"abcab"

Output

The output will be a Boolean representing whether the string is palindrome or not. For the above two inputs, the outputs will be:

true
false

Coding exercise

Implement the isPalindrome(s) function, where s is the string. The function returns true or false depending on whether the string is palindrome or not

Level up your interview prep. Join Educative to access 80+ hands-on prep courses.