Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void permutation(String str)
- {
- permutation(str, "");
- }
- public static permutation(String str, String prefix)
- {
- if(str.length() == 0)
- System.out.println(prefix);
- else {
- String rem = str.substring(0, i) + str.substring(i + 1);
- permutation(rem, prefix + str.charAt(i));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement