Palindrome Sentence
Easy Accuracy: 38.19% Submissions: 301 Points: 2

Given a single sentence s, check if it is a palindrome or not. Ignore white spaces and any other character you may encounter. 

Example 1:

s = race car.
Output: 1 
Explanation: processing str gives us
"racecar" which is a palindrome.

Example 2:

s = hello world.
Output: 0
Explanation: processing str gives us
"helloworld" which is not a palindrome.

Your Task:  
You dont need to read input or print anything. Complete the function sentencePalindrome() which takes a string as input parameter and returns a boolean value denoting if sentence is a palindrome or not.

Note: The driver code prints 1 if the returned value is true, otherwise 0.

Expected Time Complexity: O(N) where N is length of s.
Expected Auxiliary Space: O(1)

1<= s.length() <= 104
All the alphabets used in the sentence are in lower case.


to report an issue on this page.


We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?


All Submissions

My Submissions:

Login to access your submissions.

Palindrome Sentence

Output Window