String palindrome
Given a string, determine if it is a palindrome, considering only alphanumeric characters.
Palindrome
A palindrome is a word, number, phrase, or other sequences of characters which read the same backwards and forwards.
Example:
If the input string happens to be, "malayalam" then as we see that this word can be read the same as forward and backwards, it is said to be a valid palindrome.
The expected output for this example will print, 'true'.
From that being said, you are required to return a boolean value from the function that has been asked to implement.
Input Format:
The first and only line of input contains a string without any leading and trailing spaces. All the characters in the string would be in lower case.
Output Format:
The only line of output prints either 'true' or 'false'.
Note:
You are not required to print anything. It has already been taken care of.
Constraints:
0 <= N <= 10^6
Where N is the length of the input string.
Time Limit: 1 second
CodingNinjas
author
2y
Space Complexity: Explanation: Time Complexity: Explanation:
Anonymous
2y
We could use 2 indices (i to go from 0->n and j to go from n->0) and continously check if the character at the index i is equal to character at index j, if it is not the case, simply return false, no ...read more
Help your peers!
Add answer anonymously...
Top Veritas Software Developer interview questions & answers
Popular interview questions of Software Developer
Top HR questions asked in Veritas Software Developer
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app