Palindrome String-Asked in interviews
Problem Statement :
You are asked to find whether a given string is a palindrome or not.
The first and only line of the input is a string s.
If the given string is palindrome then print out “Yes” otherwise print out “No”
Explanation of given Test Cases :
The reverse of the given string is equal to the (ABCDCBA) which is equal to the given string. Therefore, the given string is palindrome.
We solve this question by traversing the string and checking whether the character at ith index is equal to the character at the (N-i-1)th index for every index in the range [0, N/2]
Time Complexity: O(N)
Space Complexity: O(1)