How to find all permutations of String in Java
First, take out the first char from String and permute the remaining chars.
If String = "abc" First, char = a and remaining chars permutations are bc and cb.
Now we can insert first char in the available positions in the permutations.
bc -> abc, bac, bca.
bb -> abc, cab, cba.
That's it, In this article We have seen How to find all permutations of String in Java
0 Comments
Post a Comment