@Test public void testPerm() { String s = "abc"; String[] expected = new String[] { "cab", "abc", "bac", "acb" }; Set<String> allPerms = perm(s); assertEquals(expected.length, allPerms.size()); stream(expected).forEach(aPerm -> assertTrue(allPerms.contains(aPerm))); }
public static Set<String> perm(String s) { Set<String> perms = new HashSet<String>(); recursivePerm(s, s.length() - 1, perms); return perms; }
PracticeQuestionsCh9 { public static Set<String> perm(String s) { Set<String> perms = new HashSet<String>(); recursivePerm(s, s.length() - 1, perms); return perms; } }
PracticeQuestionsCh9 { public static Set<String> perm(String s) { Set<String> perms = new HashSet<String>(); recursivePerm(s, s.length() - 1, perms); return perms; }  }
PracticeQuestionsCh9 { public static Set<String> perm(String s) { Set<String> perms = new HashSet<String>(); recursivePerm(s, s.length() - 1, perms); return perms; }  static int magicIndex(int[] array, int startIndex, int endIndex); static Set<String> perm(String s); }
PracticeQuestionsCh9 { public static Set<String> perm(String s) { Set<String> perms = new HashSet<String>(); recursivePerm(s, s.length() - 1, perms); return perms; }  static int magicIndex(int[] array, int startIndex, int endIndex); static Set<String> perm(String s); static final Logger LOGGER; }