Program to print smallest and biggest possible palindrome word in a given string8 Jan 2025 | 2 min read In this program, we need to find the smallest and biggest palindromic word present in the given string. Wow you own kayak In above example, wow represent the smallest palindrome and kayak represent the biggest palindrome. One of the approach to accomplish this task is split the string into word. Then, check whether the words are palindrome or not. Then, compare their length to find out the minimum and maximum palindromic word. Algorithmmain()
isPalindrome(String a)
Program:Output: Number of words present in given file: 63 Next TopicJava Programs |
In this program, we will create a singly linked list and add a new node at the beginning of the list. To accomplish this task, we will store head to a temporary node temp. Make newly added node as the new head of the list....
5 min read
The natural numbers are the numbers that include all the positive integers from 1 to infinity. For example, 1, 2, 3, 4, 5, ......, n. When we add these numbers together, we get the sum of natural numbers. In this section, we will create the following programs: Java...
3 min read
In this program, we need to check whether the given matrix is a sparse matrix. A matrix is said to be sparse matrix if most of the elements of that matrix are 0. It implies that it contains very less non-zero elements. To check whether the given...
3 min read
? Two strings are called anagrams if they contain same set of characters but in different order. "keep ? peek", "Mother In Law - Hitler Woman". File: AnagramString .java import java.util.Arrays; public class AnagramString { static void isAnagram(String str1, String str2) { String s1 = str1.replaceAll("\\s", ""); String s2 = str2.replaceAll("\\s", ""); boolean...
1 min read
In this program, we will create a doubly linked list then, iterate through the list to find out the minimum and maximum node. We will maintain two variables min and max. Min will hold the minimum value node, and max will hold the maximum value node....
6 min read
Selection sort is an easy-to-understand and straightforward kind of algorithm that sorts elements in a list or array, either ascending or descending. The element idea at the core of selection sort is to obtain repeatedly the minimum (or the maximum) element of the unsorted part...
7 min read
12344321 123**321 12****21 1******1 Algorithm: STEP 1: START STEP 2: SET lines=4 STEP 3: DEFINE i, j. STEP 4: SET space=0 STEP 5: SET i=0 STEP 6: REPEAT STEP 7 TO 20 UNTIL i STEP 7: SET j=1 STEP 8: REPEAT STEP 9 UNTIL j <= space. STEP 9: PRINT " " and SET J=J+1 STEP 10: SET...
2 min read
In this program, we need to display the upper triangular matrix. Upper Triangular Matrix Upper triangular matrix is a square matrix in which all the elements below the principle diagonal are zero. To find the upper triangular matrix, a matrix needs to be a square matrix that...
4 min read
Program to print the smallest element in an array In this program, we need to find out the smallest element present in the array. This can be achieved by maintaining a variable min which initially will hold the value of the first element. Loop through the...
2 min read
. In this program, we need to find the reverse of the string. This can be done by iterating the string backward and storing each character from the original string into a new string. Original string: Dream big Reverse of the string: big maerD ALGORITHM STEP 1: START STEP 2: DEFINE...
2 min read
We request you to subscribe our newsletter for upcoming updates.
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India