Amazon Interview Question for Quality Assurance Engineers


Country: India
Interview Type: Written Test




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

Make hash table of S1. Iterate S1 if all elements are present and iterate S3 if any one element is missing by checking with hash table of S1.

- Anonymous May 10, 2019 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

import java.util.HashMap;
import java.util.Map;

public class SubSetQuestion {

	public static void main(String[] args) {
		int[] S1 = {1,5,4,6,8,2};
		int[] S2 = {5,8,2};
		int[] S3 = {5,8,2,7};
		
		Map<Integer, Integer> map = new HashMap();
		for(int i=0;i<S1.length;i++)
		{
			map.put(S1[i], 1);
		}
		
		for(int i=0;i<S2.length;i++)
		{
			if(!map.containsKey(S2[i]))
				System.out.println("S2 is not subset");
		}
		
		for(int i=0;i<S3.length;i++)
		{
			if(!map.containsKey(S3[i]))
				System.out.println("S3 is not subset");
		}


	}

}

- Kamna May 12, 2019 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

public static void findSubset(){
    int s1[]={1,5,4,6,8,2};
   int s2[]={5,8,2};
    //int s2[]={5,8,2,7};
    
    if(s2.length > s1.length || s2.length == 0)
        System.out.println(s2+" is not a subset of "+s1);
    
    int k=0;
    boolean isSubset=false;
    for(int i=0;i<s1.length;i++){
        if(s1[i] == s2[k]){
            if(k+1 == s2.length){
              System.out.println(s2+" is a subset of "+s1);
              isSubset=true;
            }
            k++;
        }
    }
    if(!isSubset)
      System.out.println(s2+" is not a subset of "+s1);
    
}

- Amod Kumar May 13, 2019 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

public static void findSubset(){
    int s1[]={1,5,4,6,8,2};
   int s2[]={5,8,2};
    //int s2[]={5,8,2,7};
    
    if(s2.length > s1.length || s2.length == 0)
        System.out.println(s2+" is not a subset of "+s1);
    
    int k=0;
    boolean isSubset=false;
    for(int i=0;i<s1.length;i++){
        if(s1[i] == s2[k]){
            if(k+1 == s2.length){
              System.out.println(s2+" is a subset of "+s1);
              isSubset=true;
            }
            k++;
        }
    }
    if(!isSubset)
      System.out.println(s2+" is not a subset of "+s1);
    
}

- Amod Kumar May 13, 2019 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

public static void findSubset(){
    int s1[]={1,5,4,6,8,2};
   int s2[]={5,8,2};
    //int s2[]={5,8,2,7};
    
    if(s2.length > s1.length || s2.length == 0)
        System.out.println(s2+" is not a subset of "+s1);
    
    int k=0;
    boolean isSubset=false;
    for(int i=0;i<s1.length;i++){
        if(s1[i] == s2[k]){
            if(k+1 == s2.length){
              System.out.println(s2+" is a subset of "+s1);
              isSubset=true;
            }
            k++;
        }
    }
    if(!isSubset)
      System.out.println(s2+" is not a subset of "+s1);

- Amod Kumar May 13, 2019 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

public static void findSubset(){
    int s1[]={1,5,4,6,8,2};
   int s2[]={5,8,2};
    //int s2[]={5,8,2,7};
    
    if(s2.length > s1.length || s2.length == 0)
        System.out.println(s2+" is not a subset of "+s1);
    
    int k=0;
    boolean isSubset=false;
    for(int i=0;i<s1.length;i++){
        if(s1[i] == s2[k]){
            if(k+1 == s2.length){
              System.out.println(s2+" is a subset of "+s1);
              isSubset=true;
            }
            k++;
        }
    }
    if(!isSubset)
      System.out.println(s2+" is not a subset of "+s1);
    
}

- Amod Kumar May 13, 2019 | 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