Valid Palindrome - aloalgo

Valid Palindrome

Easy

You are given a string s.

Your task is to determine if the given string s is a palindrome (a sequence of characters that reads the same forward and backward), returning true if it is and false otherwise.

You may assume that:

  • The string s will be composed solely of lowercase English letters or spaces.

Example 1

Input
"taco cat"
Output
True
Explanation:

'taco cat' reads the same forwards and backwards when ignoring spaces.

Example 2

Input
"hello world"
Output
False
Explanation:

'hello world' does not read the same forwards and backwards.

Example 3

Input
"a"
Output
True
Explanation:

A single character string is a palindrome.

Loading...
Input
"taco cat"
Output
True

Hello! I am your ✨ AI assistant. I can provide you hints, explanations, give feedback on your code, and more. Just ask me anything related to the problem you're working on!