Checking for Palindrome
An efficient way of checking if a string is a palindrome.
Procedure :
Calculate the length of string if it isn't given as input.
Initialise i with 0 and j with length - 1.
Run a for loop till i < j.
Compare the i-th and j-th character in each iteration.
If it's not the same, return 0 (false).
Else, return 1 (true) after the loop is completed.
C Function :
Contributed by Nitin Ranganath
Last updated