Permutations of a string

前端 未结 4 1749
遥遥无期
遥遥无期 2021-01-28 21:03
public class Permute {
    public static void main(String[] args) throws IOException {
        System.out.println(\"Enter a string\");
        BufferedReader bufReader =         


        
4条回答
  •  走了就别回头了
    2021-01-28 21:37

    Replace two lines in the for loop with following:

     String partString = input.substring(0, i) + input.substring(i + 1);
     shuffle(dummy + input.charAt(i), partString);
    

    Since this looks like your homework I will let you figure out. If not, will post explanation after a bit ( got to get back to my day job ;) )

提交回复
热议问题