Pergunta de entrevista da empresa Microsoft

Write recursion that calculate the permutation of string

Respostas da entrevista

Sigiloso

13 de jul. de 2018

public static void perms(String s,String acc) { if(acc.length()==0) { System.out.println(i+") "+s); i++; } else { for (int i = 0; i < acc.length(); i++) { char a=acc.charAt(i); String newString= acc.substring(0, i)+acc.substring(i+1, acc.length()); perms(s+a,newString); } } and call perms("",s);

Sigiloso

3 de jul. de 2015

I came up with something.