Interview Question for Software Engineer / Developers

Country: United States
Interview Type: In-Person

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

Writing loops will make the code static as the number of product options might change. Generally these are done with recursion. Am not sure about PHP but in python I will use a list of list and c i will use use an array of struct as data structures.

- kr.neerav June 25, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
of 0 vote

private static int count = 0;

	private static void arrange(String[] product, String[][] parameters,
			int wInd) {
		if (wInd == 0) {
			// System.out.println("" + ++count + " " + Arrays.toString(prod));
			System.out.print(++count + " ");
			for (String p : product) {
		} else {
			for (int k = 0; k < parameters[wInd - 1].length; k++) {
				product[wInd - 1] = parameters[wInd - 1][k];
				arrange(product, parameters, wInd - 1);

	public static void main(String[] args) {
		String[] productName = new String[] { "shoes", "boot" };
		String[] style = new String[] { "001", "002" };
		String[] color = new String[] { "red", "blue" };
		String[] size = new String[] { "7", "8", "9" };
		String[] gender = new String[] { "m", "f" };
		String[][] parameters = new String[][] { productName, style, color,
				size, gender };
		String[] product = new String[parameters.length];
		arrange(product, parameters, product.length);

- Oleg G June 25, 2014 | Flag Reply

Add a Comment

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


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


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