Learn
Exam

Check Palindrome

Difficulty
STARTER

Problem

Given a string word, write a solution function that returns true if the string is a palindrome, otherwise returns false.
Palindrome refers to a string that reads the same backward as forward.


Constraints

  • The length of word is between 1 and 100, inclusive.
  • word consists only of lowercase English letters.

Test Cases

Test Case Number word return
1 "racecar" true
2 "hello" false
3 "level" true

Explanation for Test Case 1

  • For word = "racecar", the reversed string is identical to the original, so the return value is true.

Explanation for Test Case 2

  • For word = "hello", the reversed string is "olleh", which is different from the original, so the return value is false.

Explanation for Test Case 3

  • For word = "level", the reversed string is identical to the original, so the return value is true.