Cisco Systems Interview Question for SDE-2s


Country: India
Interview Type: Written Test




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

Any solution?

- Deep November 04, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Could you explain the question in more detail.

- revanthpobala November 05, 2015 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

pls help me yooooooooooo

- Anonymous November 05, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

{dvfgdffgdfgd}

- dfsdgfgdf November 06, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

public class CandidateCode 
{ 

	static int  finalCount=0;
    public static int distributeCadbury(int input1,int input2,int input3,int input4)
    {
        
        ArrayList<String> boxDimensions = new ArrayList<String>();
       /* boxDimensions.add(String.valueOf(input1)+"*"+String.valueOf(input2));
        boxDimensions.add(String.valueOf(input3)+"*"+String.valueOf(input4));
        boxDimensions.add(String.valueOf(input1)+"*"+String.valueOf(input4));
        boxDimensions.add(String.valueOf(input3)+"*"+String.valueOf(input2));*/
        ArrayList<String> length = new ArrayList<String>();
        ArrayList<String> breadth = new ArrayList<String>();
        length.add(String.valueOf(input1));
        length.add(String.valueOf(input2));
        breadth.add(String.valueOf(input3));
        breadth.add(String.valueOf(input4));
        
        for (String len : length) {
			for (String bre : breadth) {
				boxDimensions.add(len+"-"+bre);
			}
		}
        
        for (String boxDim : boxDimensions) {
        	System.out.println("boxDim: "+boxDim);
        	int count = 0;
        	String[] dim = boxDim.split("-");
        	if(boxDim != null){
    		Integer len = Integer.valueOf(dim[0]);
			Integer bre = Integer.valueOf(dim [1]);
        	count = calcualteCount(count, len, bre);
        	finalCount = finalCount+count;
        	}
		}
        
        System.out.println("Finalcount"+finalCount);
		return finalCount;
        
    }
    private static int calcualteCount(int count, int len,  int bre) {
 		//System.out.println(count+":"+len+":"+bre);
			if(len > bre){
 			if(len - bre >= 0 && len > 0 && bre > 0){
 				count = calcualteCount(count, (len - bre) , bre);
 				count = count+1;
 			}else{
 				return count;
 			}
 			
 		}else{
 			if(bre - len >= 0 && bre > 0 && len > 0){
 				count = calcualteCount(count, len, (bre - len));
 				count = count+1;
 			}else{
 				return count;
 			}
 			
 		}
		return count;
		
		
	}

- Ramya May 22, 2016 | 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