Java program to check palindrome (using library methods)
Given a string, write a Java function to check if it is palindrome or not. A string is said to be palindrome if reverse of the string is same as string. For example, “abba” is palindrome, but “abbc” is not palindrome. The problem here is solved using string reverse function. Examples:
Input : malayalam Output : Yes Input : GeeksforGeeks Output : No
Time complexity: O(N), where N is length of given string.
Auxiliary Space: O(N), The extra space is used to store the reverse of the string.
Related Article : C program to check whether a given string is palindrome or not This article is contributed by Bhargav Sai Gajula. If you like GeeksforGeeks and would like to contribute, you can also write an article using write.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks. Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.