Friday, August 16, 2013

Amazon–Application Support Engineer Interview

 

Face to Face  - Round 1

1) find the nth node from the last

2) Palindrome in Linked list

3) trouble shooting questions like "server is slow, need to find out the reasons why it is slow and how to make it fast"

Face to Face - Round 2

Many shell scripting questions

some trouble shooting questions

Face to Face - Round 3

Find an element in a pivoted array

troubleshooting questions : Website is slow/down. How to optimize to back end to make it up/fast.

Round 4 & 5 :

All questions related to  project (current employee / college project) , challenges faced in project, how i resolved it , strength, responsibilities etc.,

As it is support engineer role, questions were mainly in trouble shooting and very basic data structures. 

Expected working code &  test cases for all data structure questions.

Wednesday, June 12, 2013

Groupon - Front End Developer - Phone interview Questions

1. Given an array . One element is occurring more than n/2 times. Need to find the element.
O(n) solution is expected.

2. Given an linked list. Need to delete m nodes from nth node.

3. Given an array. Need to find 3 elements. Where A[i] < A[j] < A[k] and i < j < k .
both indices and array elements should satisfy the above condition.
O(n) solution is expected.

Sunday, April 21, 2013

Amazon Support Engineer - Online Test

Total 10 questions (7 MCQ & 3 Programming Questions)

7 MCQ questions includes the following sections:


1. Stacks & Queues
2. Min Heap
3. Linked List (circular Linked List)
4. DBMS Questions (DDL , dML)
5. OS questions (semaphore)
6. Aptitute Question
7. Given a program , what is the output ? (Given, virtual function questions)

3 Programming Questions:


8. Pattern Matching Question
9. Swap adjacent nodes in a linked list.
10. Write a script to print the uniq phone numbers in a folder which contains list of html files.
phone numbers can be in any format (xxxxxxxxxx , xxxxx-xxxxx , xxx-xxx-xxxx)

Online test conducted through Interviewstreet.com

Tuesday, March 26, 2013

Matrix Problems

Some matrix (2D array) problems

1. Given two matrices, perform Matrix Addition

2. Given two matrices, perform Matrix Subtraction

3. Given two matrices, perform Matrix Multiplication

4. Given two matrices, perform Matrix Division

5. Given a matrix , output the mirror of the matrix

6. Given a matrix , output 90 degree left rotation 

7. Given a matrix , output 90 degree right rotation

8. Given a matrix , make diagonal elements zero

9. Given a matrix , make elements zero except diagonal

10. Given a matrix , Make upper triangular matrix zero

11. Given a matrix , Make lower triangular matrix zero

12. Given two matrix , Check whether both are identical

13. Given a matrix , some element mXn is zero. Make the Mth row & Nth column zero.

14. Given a matrix, Adding upper & lower triangular matrix

15. Given a matrix , Swapping upper & lower triangular matrix elements

16. Given a matrix , Make the elements in the border are zero.

17. Given a matrix , Make the corner elements zero.

18. Given a matrix , perform binary search in a matrix

Sunday, March 17, 2013

Quick Sort



#include<stdio.h>
#define MAX 10
void qsort(int A[], int p, int r);
int partition(int A[], int p, int r);

main()
{
int Arr[MAX]={10,4,5,6,2,3,8,1,9,7};
int i;
qsort(Arr,0,MAX);

for(i=0;i<MAX;i++)
printf("%d ",Arr[i]);
}

void qsort(int A[], int p, int r)
{
int q;
if(p<r)
{
q=partition(A,p,r);
qsort(A,p,q-1);
qsort(A,q+1,r);
}
}

int partition(int A[], int p, int r)
{
int i , j , x,tmp;
x=A[r];
j=p;
i=p-1;
while(j<r)
{
if(A[j]<x)
{
i=i+1;
// Exchange A[i] & A[j]
tmp=A[j];
A[j]=A[i];
A[i]=tmp;
}
j++;
}
// Exchange A[i+1] & A[r]
tmp=A[i+1];
A[i+1]=A[r];
A[r]=tmp;

return i+1;
}

Output:
1 2 3 4 5 6 7 8 9 10

Time Complexity:
Best - O( n log n )
Average - O(n log n )
Worst - O( n^2)

Pair Wise Swapping in a Linked List


#include<stdio.h>
#include<stdlib.h>

typedef struct list
{
int info;
struct list *next;
}node;

node * head;

void insert(int data);
void display();
void pairwise_swapping(node *ptr);
void swap(int *a, int *b);

void insert(int data)
{
node *ptr , *tmp;
ptr=(node*)malloc(sizeof(node));

if(ptr==NULL)
return;

(*ptr).info=data;
(*ptr).next=NULL;
if(head==NULL)
{
head=ptr;
}
else
{
tmp=head;
while((*tmp).next!=NULL)
tmp=(*tmp).next;

(*tmp).next=ptr;
}
}

void display()
{
node * ptr;

if(head==NULL)
{
printf("list is empty\n");
return;
}

for(ptr=head;ptr!=NULL;ptr=(*ptr).next)
printf("%d ",(*ptr).info);
}

void swap(int *x , int *y)
{
int temp;
temp=*x;
*x=*y;
*y=temp;
}

void pairwise_swapping(node *ptr)
{
node *tmp , *tmp_next;
tmp= ptr;
while (tmp!=NULL && (*tmp).next!=NULL)
{
tmp_next = (*tmp).next;
swap(&(*tmp).info , &(*tmp_next).info);
tmp=(*tmp_next).next;
}
}

main()
{
insert(1);
insert(2);
insert(3);
insert(4);
insert(5);
insert(6);
pairwise_swapping(head);
display();
}

Output:
2 1 4 3 6 5