Efficient Way to Check String is Palindrome or Not

A String can be Palindrome if that reads the same forward or reversed. For example, ‘radar’, ‘level’ , ‘refer’ are some Palindrome words.
A String is palindrome or not can be checked using different approaches but the best approach is to compare string first and last character and then proceed further
Program to check Palindrome using above approach

other approach can be to reverse the string and the compare the original with revers string, if both string are equal it means they are Palindrome, otherwise they are not
Code using above approach

String is Palindrome or not can also be checked using recursion
Program using recursion

A String is Palindrome or not can be checked using the different logic’s, but the best one is to compare the starting character and last character and proceed further.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.