How do you find duplicate characters in a string?7 Jan 2025 | 1 min read Following program demonstrate it. File: DuplicateCharFinder .java Output: is 3 times i is 2 times n is 2 times y is 2 times Next TopicJava program to print spiral pattern |
A number is prime if it is divisible by 1 and itself. In other words, a prime number is a natural number with exactly two distinct natural number divisors 1 and itself. For example, 2, 3, 5, 7, 11, etc. are the prime numbers. Note that...
5 min read
Java program to print the following pattern on the console Algorithm: STEP 1: START STEP 2: SET coe=1, rows= 6. STEP 3: SET i=0. REPEAT STEP 4 to STEP 11 UNTIL i STEP 4: SET space = 1. REPEAT STEP 5 and STEP 6 UNTIL space<(rows ?i) STEP 5: PRINT...
2 min read
We can capitalize each word of a string by the help of split() and substring() methods. By the help of split("\\s") method, we can get all words in an array. To get the first character, we can use substring() or charAt() method. Let's see the example...
1 min read
In this program, we need to find the frequency of each character present in the word. Picture perfect To accomplish this task, we will maintain an array called freq with same size of the length of the string. Freq will be used to maintain the count of...
3 min read
In a Jail, a corridor is provided. The length of the corridor is L units. An array lightArr[] is given, which is also of the size L. The lightArr[] contains only to values 0 & 1. At each unit of the corridor a light is given....
14 min read
Java Convert double to int We can convert double to int in java using typecasting. To convert double data type into int, we need to perform typecasting. Typecasting in java is performed through typecast operator (datatype). Here, we are going to learn how to convert double primitive type into...
1 min read
In this program, we need to calculate the sum of all the elements of an array. This can be solved by looping through the array and add the value of the element in each iteration to variable sum. Sum of all elements of an array is...
2 min read
In this section, we will learn what is an emirp number and also create Java programs to check if the given number is emirp or not. The emirp number Java program frequently asked in Java coding tests to check the logic of the programmer. Emirp Number A number...
2 min read
In this program, we will create a doubly linked list and count the number of nodes present in the list. To count the node, we traverse through the list by incrementing the counter by 1. What count of nodes presents above doubly linked list is 5. Algorithm Define...
5 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
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