Interview Question for Analysts






Comment hidden because of low score. Click to expand.
0
of 0 vote

We have to print all the combination of "abcdef". This can be easily done using recursion with backtracking.

- DashDash October 18, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Java?

- Anonymous October 19, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

can you please tell how to use recursion for this.

- Anonymous October 19, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

can you please tell how to use recursion for this.

- sushantmax88 October 19, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

We can do like this in java

public static ArrayList<String> permutation(String s)
	{
		if(s==null)
		return null;
		if(s.length()<=1)
		{
			ArrayList<String> a=new ArrayList<String>();
			a.add(s);
			return a;
		}
		char c=s.charAt(0);
		ArrayList<String> a2=permutation(s.substring(1,s.length()));
		for(String s2:a2)
		{
			for(int i=0;i<s2.length()+1;i++)
			{
				String s3=insert(s2,i,c);
				a.add(s3);
			}
		}
		return a;
	}
	public static String insert(String s,int i,char c)
	{
		String s1=s.substring(0,i);
		String s2=s.substring(i);
		String s3=s1+c+s2;
		return s3;
	}

- gulusworld1989 October 19, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Problem is to find all permutation of given string.
I will go with c++ as there is in-built function next_permutation to do this.

cplusplus.com/reference/algorithm/next_permutation/

- Anonymous November 17, 2010 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More