~/DHRUVUpskilling
← board/DSA/Two Pointers/DSA-09
Backlog·queued

Valid Palindrome

DifficultyMedium
PatternTwo Pointers
TrackDSA
tl;dr

Write a function that takes a string, s, as an input and determines whether or not it is a palindrome

full write-up

Note

A palindrome is a word, phrase, or sequence of characters that reads the same backward as forward.

Constraints

  • 1 ≤ s.length ≤ 2 × 10⁵
  • The string s will contain English uppercase and lowercase letters, digits, and spaces.

Examples

Example 1

Input: ABCBA

Output: TRUE

Example 2

Input: ABCCA

Output: FALSE