IsPalindrome

Medium

Given a string, return whether it is palindrome.

Spaces do not matter. Not case-sensitive.

Parameter(s):

  • str: a string

Returns:

  • boolean: whether it is palindrome

Constraints:

  • str ≠ null
  • 1 ≤ str.length ≤ 1000

Example 1:

Input:

"rar"

Output:

true

Example 2:

Input:

"cat"

Output:

false

Example 3:

Input:

"Bat tab"

Output:

true