Skip to content

Instantly share code, notes, and snippets.

@EFox2413
Forked from anonymous/permutations
Created July 16, 2013 15:40
Show Gist options
  • Save EFox2413/6009865 to your computer and use it in GitHub Desktop.
Save EFox2413/6009865 to your computer and use it in GitHub Desktop.
public void permutate(String beginning, String input){
if(input.length() == 1){
System.out.println(beginning + input);
}
else
for(int i = 0; i < input.length(); i++){
permutate(beginning + input.charAt(i), input.substring(0,i) + input.substring(i + 1));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment