Error
|
|
---|---|
@Ibrahim Nash | 5761 |
@blackshadows | 5715 |
@akhayrutdinov | 5111 |
@mb1973 | 4989 |
@Quandray | 4944 |
@saiujwal13083 | 4506 |
@sanjay05 | 3762 |
@marius_valentin_dragoi | 3516 |
@sushant_a | 3459 |
@verma_ji | 3341 |
@KshamaGupta | 3318 |
Complete Leaderboard | |
|
|
@aroranayan999 | 1115 |
@bt8816103042 | 739 |
@thealchemist627 | 456 |
@dalwainazism125 | 453 |
@akashkale117 | 453 |
@shivanandp12345678910 | 453 |
@codeantik | 448 |
@SherlockHolmes3 | 447 |
@SHOAIBVIJAPURE | 430 |
@shalinibhataniya1097 | 408 |
@ShamaKhan1 | 392 |
Complete Leaderboard |
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:
Input:
s = race car.
Output: 1
Explanation: processing str gives us
"racecar" which is a palindrome.
Example 2:
Input:
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 s 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)
Constraints:
1<= s.length() <= 104
All the alphabets used in the sentence are in lower case.
We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?
Yes