Is the Text a Palindrome? (Set 1)

Easy

Given a lowercase string text, return true when it reads the same forwards and backwards.

Is the Text a Palindrome? (Set 1) — the data. This set runs 4 cases: text is a string of 3–12 characters. The hidden cases are the largest of the set.

Example 1

isPalindromeText()
Input
text = "lyyl"
Output
true

Why

`isPalindromeText` returns `true` for this input.

Example 2

isPalindromeText()
Input
text = "stz"
Output
false

Why

`isPalindromeText` returns `false` for this input.
Constraints
0 <= text.length <= 10^5
`text` contains lowercase letters only.
Every case in this set must pass: the first two are visible on Run, the last two unlock on Submit.

Topics

StringsTwo Pointers

Implement isPalindromeText in the editor and return the answer — printing it is never graded.