Flipkart Interview Question for Java Developers


Team: Machine coding
Country: India
Interview Type: In-Person




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

This has already been discussed. You can check it out here:
careercup dot com / question?id=6669318070730752

- puneet.sohi April 26, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

public class ThreeStrings {
public static void main(String[] args) {
String a="dhffyhtdhjdhgsdeadhjglktji", b="kjjgtytfctesfewajkjgjhvfhjfc",c="trcgcv" ;
String subStr = "",temp="";
Boolean flag=false;
for (int i=0;i<a.length();i++){
String chr = a.charAt(i)+"";
if(b.contains(chr) && !c.contains(chr)){
if(!flag)
temp+=a.charAt(i)+"";
else{
if(subStr.length()<temp.length())
subStr=temp;
temp=chr;
flag=false;
}
}
else
flag=true;
}
System.out.println(subStr);
}
}

- Suresh Chirra April 26, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

As mentioned in qus ' smallest sub-sequence in a' so smallest is possible for single char, hence just find a char which is present in a and b but not in c is the ans.

I think qus should had to be ' longest subsequence in a'

- PKT May 18, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Should contain all the characters from 'b'.

- juggernaut May 21, 2014 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

oh ok...my fault.... i misunderstood the qus...

- PKT May 21, 2014 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

package string;

public class ThreeStrings {
	
	public static void main(String[] args) {
		
		String StrA = "abcdecfghij" , StrB = "fedb" , c="ahij";
		
		String temp = "" , subStr = "";
		
		boolean startOver = false;
		for(int i=0;i<StrA.length();i++) {
			
			char ch = StrA.charAt(i);
			if(StrB.contains(""+ch) || startOver) {
				startOver = true;
				if(c.contains(""+ch)) {
					
					startOver = false;
					temp = "";
				}
				
				else {
					
				temp = temp+ch;
				if(containsAll(temp, StrB)) {
					
					System.out.println(temp);
					break;
				}
				
				}
				
			}
			
			
		}
		
		
		
	}
	
	static boolean containsAll(String a , String b) {
		
		for(int i=0;i<b.length();i++) {
			
			if(!a.contains(b.charAt(i)+"")) {
				return false;
			}
		}
		
		return true;
	}
}

- shukad333 August 31, 2014 | 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