Sunday, August 12, 2012

Interview with Amazon

Interview with Amazon

It was awesome experience on 11th August, I never expected to reach till last but i could make it. But i have missed the job :-( Lets see my next attempt will give me this opportunity.

Here i am sharing my written Test Exam:

Q1. Here two lists are given.
list1 = 2 > 4 > 5 > 6 > NULL:
list2 = 5 > 6 > 7 > NULL;

list3 =     3 > 0 > 2 > 3 > NULL;

This is called summation of link lists.
Constraint: Link list data node can contain only one digit.

Write: Input and Output data by dry running your program.

Q2. You have to find out maximum number by rearranging the digits of number.

Example: 2789
Output: 9872

Complexity: O(n)

Q3. Write a program for finding depth of BST (Binary Search Tree).

Write by Iterative and Recursion.

Q4. (a) Find output of program
int mingle(int a, int b)
{
    int c;
    c  = b /2;

if (b<=2)
cout<return a*2(b/2) + mingle(a,c);
}

int main(){
for(i=0;i<5 i="i" p="p">{
     mingle(i+1,i-1)
}
}

(b)
Find out the bug in the following program.
findAanda(char * str, unsigned int len)
{
do
{
if(str[i]=='A' || str[i] == 'a')
{
  ret++;
}
else
i++;
}
return ret;
}

Interview 1:
Q1. Define and explain about youtube.com web architecture.

Q2. write TEST data for maximum of subarray in a given array.

like
array = 2 10 40 68 49 10 11

Answer = 40 68 49

Interview 2:

Q1. Find loop in a link list and length of link list.

Q2. Find the given char string is a anagram or not
Solutions should be in O(n) complexity.

Interview 3:

Q1. Write a program for printing 1 0 1 0 1 0 from a array where 1 and 0 are distributed in random form.\
A = [1,1,1,0,0,0,1,0]
A = [1,0,1,0,1,0,1,0]

Q 2. In order traversal of a Tree using iterative method.

Interview 4:

Q1.  Write a program for printing a matrix in spinal order.

       | 2   4   6  |
A = | 5   8   9  |
       | 10 3   5  |

Values should print like this:
2 4 6 9 5 3 10 5 8

Q 2. I have forgot, as will remember i'll post it here.


Please write your answers...
I'll post the answers soon
Best of luck of your interviews


1 comment:

  1. @sati: A little mistake..please ignore this.

    Loop:
    for(i=0;i<5; i++>{
    mingle(i+1,i-1);
    }

    This might be editing problem.

    ReplyDelete

Interview With Amazon Chennai

Interview With Amazon Chennai Interview 1: Coding Problem: Q1. Write down a program which will sort the values at the level in...