Interview Question

Software Engineer Intern Interview Seattle, WA

Given a string, output all its permutations


Interview Answer

1 Answer


public class StringPerm {

    public static void Permutation(String strsub, String str)
        int length=str.length();
            for(int i=0;i<length;i++)
                String newString=str.substring(0, i)+str.substring(i+1);

    public static void main(String []args)
        String str,strsub;
        Scanner in = new Scanner(;
        System.out.print("Enter the string to be permuted : ");
        System.out.println("Possible Permutations of Strings : ");


Mahesh Babu on Feb 9, 2013

Add Answers or Comments

To comment on this, Sign In or Sign Up.