Java Program to find all the permutations of a string17 Mar 2025 | 2 min read To solve this problem, we need to understand the concept of backtracking. According to the backtracking algorithm:
![]() For programming, follow the algorithm given below: Algorithmmain()
generatePermutation(String str, int start, int end)
swapString(String a, int i, int j)
Program:Output: All the permutations of the string are: ABC ACB BAC BCA CBA CAB Next TopicJava Programs |
In this section, we will learn what is a spy number and also create Java programs to check if the given number is Spy or not. The spy number program is frequently asked in Java coding test. Spy Number A positive integer is called a spy number if...
3 min read
Java Program to find Third Largest Number in an Array We can find the third largest number in an array in java by sorting the array and returning the 3nd largest number. Let's see the full example to find the third largest number in java array. public class...
2 min read
Java Convert Hexadecimal to Decimal We can convert hexadecimal to decimal in java using Integer.parseInt() method or custom logic. Java Hexadecimal to Decimal conversion: Integer.parseInt() The Integer.parseInt() method converts string to int with given redix. The signature of parseInt() method is given below: public static int parseInt(String s,int redix) Let's see...
2 min read
In this section, we will learn how to create a Java program to find the smallest of three numbers. Along with this, we will also learn how to find the smallest of three numbers in Java using the ternary operator. Using Ternary Operator Before moving to the program,...
3 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
Java Program to add two matrices We can add two matrices in java using binary + operator. A matrix is also known as array of arrays. We can add, subtract and multiply matrices. To subtract two matrices, use - operator. Let's see a simple example to add two...
1 min read
Java Convert String to char We can convert String to char in java using charAt() method of String class. The charAt() method returns a single character only. To get all characters, you can use loop. Signature The charAt() method returns a single character of specified index. The signature of charAt()...
2 min read
In this program, we will create a circular linked list and insert every new node at the end of the list. If the list is empty, then head and tail will point to the newly added node. If the list is not empty, the newly...
6 min read
In this program, we create a circular linked list and insert a new node in the middle of the list. If the list is empty, both head and tail will point to new node. If the list is not empty, then we will calculate the...
8 min read
In this program, we need to replace all the spaces present in the string with a specific character. String: Once in a blue moon String after replacing space with '-': Once-in-a-blue-moon One of the approach to accomplish this is by iterating through the string to find spaces. If...
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