Amazon Interview | Set 2

Feed: GeeksforGeeks
Posted on: Saturday, August 25, 2012 10:10 PM
Author: GeeksforGeeks
Subject: Amazon Interview | Set 2

Please find the details of my amazon interviews below. Date of Interviews: 26th July 2012 No of Rounds: 1 online exam + 4 PI Type of Interviews: Campus Interview for freshers Online test(Time): 90 Minutes 20 Objective Questions: Aptitude and basic C objective problems. 2 Subjective Questions: I. Given a linked list […]

The post Amazon Interview | Set 2 appeared first on GeeksforGeeks.

y60cViZwvRE

View article…

GeeksforGeeks

A computer science portal for geeks

Subscribe

Amazon Interview | Set 2

August 26, 2012

Please find the details of my amazon interviews below.

Date of Interviews: 26th July 2012

No of Rounds: 1 online exam + 4 PI

Type of Interviews: Campus Interview for freshers

Online test(Time): 90 Minutes

20 Objective Questions: Aptitude and basic C objective problems.

2 Subjective Questions:

I. Given a linked list containing character in each node, segregate its nodes in such a way that all nodes containing a vowel are moved to the end of the linked list. We will have to maintain the order.

II. Parenthesis checker.

Interview Round 1(30-40 Minutes):

Technical Interview

Question 1: You are given a linked list and a parameter k. You will have to swap values in a certain fashion, swap value of node 1 with node k, then node (k+1) with node 2k and go on doing this in the similar fashion

Question 2: For the above question, do it without swapping the values. If you want a swap to occur between two nodes, then you will have to move the nodes itself.

Interview Round 2(50-60 Minutes):

Technical Interview

Question 1: You are given many slabs each with a length and a breadth. A slab i can be put on slab j if both dimensions of i are less than that of j. In this similar manner, you can keep on putting slabs on each other. Find the maximum stack possible which you can create out of the given slabs.

Question 2: The above question was raised to 3 dimensions.

Question 3: The above question was then raised to k dimensions.

Questions : Then there were many questions asked on compilers and dynamic memory allocation.

Interview Round 3(50-60 Minutes):

Technical Interview

Question 1: You are given pairs of numbers. In a pair the first number is smaller with respect to the second number. Suppose you have two sets (a, b) and (c, d), the second set can follow the first set if b<c.So you can form a long chain in the similar fashion. Find the longest chain which can be formed.

Question 2: Find the longest increasing subsequence in O(nlogn). Proof and full code was required.

Question 3: You are given a linked list and an integer k. Reverse every consecutive k nodes of the given linked list.

Question 4: You are given an array. For every element you have to replace it with the closest number on the right side which is greater than the element itself.

Interview Round 4:

The team was highly impressed so they cancelled my 4th round :P for others who appeared for the 4th round, it was atleast an hour long.

HIRED!! :)

This article is compiled by Jinendra Baid. Many Many congratulations to Jinendra for his selection in Amazaon. If you like GeeksforGeeks and would like to contribute, you can also write an article and mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

26 comments so far

  1. epic_coder says:
    September 23, 2012 at 3:26 PM
    I am surprised to see questions 1,2 and 3 in interview 2 and question 1 in interview 3 are so similar to each other. If you solved one of them, you would probably solves all of them.

     /* Paste your code here (You may delete these lines if not writing code) */ 

    Reply

  2. Amit says:
    August 28, 2012 at 12:28 PM
    round 3–ques 4
    can we have a better approach than these,i mean linear search for each element-O(n^2)

     void myfunc(int a[],int n) { int i,j; for(i=0;i < n-1;i++) { j=i+1; while(j < n && a[j] <= a[i]) j++; if(j < n) a[i] = a[j]; } } 

    Reply

  3. rkt says:
    August 27, 2012 at 1:24 PM
    @Jinendra For LIS problem, did you give the dynamic programming O(n^2) solution or the O(nlogn) solution?

    Reply

  4. abc says:
    August 26, 2012 at 11:36 PM
    hi can you tell me more about the aptitude questions

     /* */ 

    Reply

  5. Amit says:
    August 26, 2012 at 8:37 PM
    For PI, Are they asking the logic or to write the complete code?

     /* Paste your code here (You may delete these lines if not writing code) */ 

    Reply

    • Jinendra says:
      August 26, 2012 at 10:18 PM
      First you have to tell them what are you going to do.Explain your logic and show them that it will give optimal result in all cases.Then they will make you write the code.Try to write a code with very few errors in first attempt.

      Reply

      • simon says:
        August 26, 2012 at 11:02 PM
        Hi jinendra,
        did you have the onsite interviews in india or in seattle ? amazon(HQ)

        Thank you!

         /* Paste your code here (You may delete these lines if not writing code) */ 

        Reply

      • Amit says:
        August 27, 2012 at 7:24 PM
        Do not you think it is quite small time to solve all the problems and then give them code also.

        If I consider, if we can code in 10 mins then we left with 5 min to come with logic for each problem.

        Whats your view on this?

        Reply

        • Jinendra says:
          August 27, 2012 at 8:39 PM
          If you want to get into companies like amazon microsoft then u will have to be that quick :)

           /* Paste your code here (You may delete these lines if not writing code) */ 

          Reply

  6. anil_kumar88 says:
    August 26, 2012 at 8:33 PM
    congrats Jinendra Baid plz provide solution also

     /* Paste your code here (You may delete these lines if not writing code) */ 

    Reply

    • Jinendra says:
      August 26, 2012 at 10:56 PM
      for interview 2 question 1 : i used a 2d matrix with two rows.all lengths in row1 and breadths in row 2. Sorted the row1 and arranged row2 with it accordingly ..now row1 is in increasing order,so we just need to find the longest incresing sequence in row 2 :)

       /* Paste your code here (You may delete these lines if not writing code) */ 

      Reply

      • Jinendra says:
        August 26, 2012 at 10:57 PM
        and to extend this to k dimensions represent each object as a node..now there is an edge from node i to node j if all dimensions of node i are smaller than that of j..now find the longest path length possible in that graph :)

        Reply

        • kalyan says:
          August 28, 2012 at 7:55 AM
          how to do for three dimensions ?

           /* Paste your code here (You may delete these lines if not writing code) */ 

          Reply

        • atul says:
          August 29, 2012 at 3:04 PM
          @Jinendra: in you k dimension approch…
          as we dont know the starting point if the node…we have to check each node and simply apply DFS to find longest path(considering unit of each path =1 ) ??
          am i correct!!

           /* Paste your code here (You may delete these lines if not writing code) */ 

          Reply

      • atul says:
        August 29, 2012 at 2:54 PM
        how about this approach for
        interview 2 question 1 :-

        sort input on base of area (length *breath)
        now find LIS such that length(i) >= length(j) and breath(i) >= breath(j)

         /* Paste your code here (You may delete these lines if not writing code) */ 

        Reply

  7. suresh says:
    August 26, 2012 at 7:45 PM
    please can give codes for above problems

    Reply

  8. leet says:
    August 26, 2012 at 3:18 PM
    for question 1 round 3 ,can you please explain more about the quesion?

     /* Paste your code here (You may delete these lines if not writing code) */ 

    Reply

    • Jinendra says:
      August 26, 2012 at 10:16 PM
      what are you not getting?? see if u have a pair (a,b)
      then a<b for all pairs.if you want to conbine two pairs (a,b) and (c,d) then a<b<c<d must be satisfied.in this manner we have to form a chain

      /* Paste your code here (You may delete these lines if not writing code) */

      Reply

      • leet says:
        August 27, 2012 at 9:47 AM
        In the question,it was not mentioned that a<b .Please confirm if it is correct.
        Can input be of form (5,3),(6,1),(2,4)?
        Thats why i was confused.

        /* Paste your code here (You may delete these lines if not writing code) */

        Reply

      • leet says:
        August 27, 2012 at 9:48 AM
        In the question,it was not mentioned that a<b .Please confirm if it is correct.
        Can input be of form (5,3),(6,1),(2,4)?
        Thats why i was confused.

        /* Paste your code here (You may delete these lines if not writing code) */

        Reply

        • Anirban says:
          August 27, 2012 at 12:21 PM
          @Jinendra
          In this question, did you solve it by creating a DAG and then finding the longest path or did you use some kind of LIS approach ?

           /* Paste your code here (You may delete these lines if not writing code) */ 

          Reply

  9. atul says:
    August 26, 2012 at 12:42 PM
    i guess interviews loves LIS problems :P:P

     /* Paste your code here (You may delete these lines if not writing code) */ 

    Reply

Comment

Click here to cancel reply.
Name (Required) Email (Required) Website URI Your Comment (Writing code? please paste your code between sourcecode tags)

 /* Paste your code here (You may delete these lines if not writing code) */ 
  • Loading
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s