Write a Program to find the longest palindrome in a given String
Output:
String: HYTBCABADEFGHABCDEDCBAGHTFYW12345678987654321ZWETYGDE
Longest Palindrome: 12345678987654321
It is just another blog for Java developers.
Java is a set of computer software and specifications developed by Sun Microsystems, which was later acquired by the Oracle Corporation, that provides a system for developing application software and deploying it in a cross-platform computing environment. Java is used in a wide variety of computing platforms from embedded devices and mobile phones to enterprise servers and supercomputers.
The Spring Framework provides a comprehensive programming and configuration model for modern Java-based enterprise applications - on any kind of deployment platform. A key element of Spring is infrastructural support at the application level: Spring focuses on the "plumbing" of enterprise applications so that teams can focus on application-level business logic, without unnecessary ties to specific deployment environments.
Hibernate ORM is an object-relational mapping framework for the Java language. It provides a framework for mapping an object-oriented domain model to a relational database.
head, mid, tailnumber = 134567329807541count = no. of characters = 15head = number.substring(0, count / 2) = number.substring(0,7) = 1345673mid = number.substring((count / 2), (count / 2) + 1) = number.substring(7,8) = 2tail = number.substring((count / 2) + 1) = number.substring(8) = 9807541
head mid tail head and compare it to tail 3765431reverse(head) <= tail ( if they are equal the initial input is a palindrome, and you want the next )mid < 9, increment midhead part and set mid := 0head mid reverse(head).