Want a Free Job Posting?

Buy a job posting today and the second one is on us. For a limited time only. Act Now.

Interview Question


was asked about perm gen in java.


Interview Answer

1 Answer


public class Permutation { stringBuilder output; String input; boolean used[]; public Permutation(String in) { this.input = in; output = new StringBuilder(); used = new Booolean[n]; } public void Permute(String in) { if(in.length() == output.length()) { print(output.toString()); } for(int i=0;i<in.length; i++) { output.append(input.charAt(i)); used[i] = true; permute(in.substring(i)); used[i] = false; output.setLength(output.length() - 1); } } }

Zahid on Nov 29, 2013

Add Answers or Comments

To comment on this, Sign In or Sign Up.