This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.LinkedHashSet; | |
import java.util.Set; | |
public class Permutation { | |
public static void main(String[] args) { | |
String str = "sonya"; // 5 * 4 * 3 * 2 = 20 * 6 = 120 | |
Permutation permutation = new Permutation(); | |
StringBuilder builder = new StringBuilder(); | |
Set<String> permSet = new LinkedHashSet<>(); | |
permutation.permute(str, builder, permSet); |