Thursday, May 31, 2012

Amazon Interview Questions

I gave an interview with Amazon in the start of the year. Here are the questions I faced:

First Round was a Written Test.
Q1) Reverse words in a sentence
Q2) Print 2D array in Spiral Order
Q3) Remove all nodes with the given value in a linked list:
       LinkList removeValues(LinkList Head, ValueObject value){
       }
 Q4) Find the first non-repeating character in a word.

Second round was a F2F technical discussion:
Given a Tree:














What is the order of nodes when you parse the tree as:

1) Breadth First:
Ans: 1 2 3 4 5 6 7 8 9
2) Reverse Breadth First
Ans: 7 8 9 4 5 6 2 3 1
3) Zig Zag
Ans: 7 8 9 6 5 4 2 3 1

He asked many followup questions on Tree Parsing, searching, Collections, LinkedLists etc.
Few of them were like:
While doing the above Breadth First, etc, How would you do it if you were to do  only using:
1) Only two Queues
2) Only 1 Queue and 1 Stack
3) Only 2 Stacks

Third Round:
He gave me pattern like:
Write a recursive program to print similar pattern shown below given any number:
Pattern 1:
number: 5

-----

-
--
-

---

-
--
-

----

-
--
-

---

-
--
-

-----

Pattern 2:

number: 4

----

-
--
-

---

-
--
-

----

Pattern 3:
number: 6

------

-
--
-

---

-
--
-

----

-
--
-

-----

-
--
-

----

-
--
-

---

-
--
-

------

If you observe the patterns,

given a number the first and last lines will have so many number of dashes.

the the common pattern occurs between dash lines:
-
--
-

Then after the first line, start with 3 dashes and go till (n-1) then go back till 3. 

4 comments:

  1. Hi

    I read this post 2 times. It is very useful.

    Pls try to keep posting.

    Let me show other source that may be good for community.

    Source: Amazon interview questions

    Best regards
    Jonathan.

    ReplyDelete
  2. Hiya,


    A spot on observation on what probably is “the” underlying details of the Techie Stuff. Too many people don’t even think about wherever there will be actual demand and more importantly what happens if this demand comes later (or maybe a lot later) than they expect


    About a year ago I made this account for some quick testing with AWS and and then it was closed. Now that I want to use AWS again, I am unable to access any services and am instead given a message that my account has been suspended.
    AWS Training




    Awesome! Thanks for putting this all in one place. Very useful!


    Obrigado,
    Ajeeth

    ReplyDelete
  3. Salama Aleikum,


    This is indeed great! But I think perhaps you are generally referring which is getting unsustainable.


    As far as all my research has led me to conclude, AWS only has one service that supports websocket protocol for pushing data straight to browsers. SNS solely supports mobile. IoT supports websocket over MQTT, albeit awkwardly, requiring you to treat ephemeral browser sessions like devices. Some AWS Tutorial USA libraries to abstract this awkward fit have popped up.




    Very useful post !everyone should learn and use it during their learning path.


    ganesh,

    ReplyDelete
  4. Salaam,


    This is indeed great! But I think perhaps you are generally referring Amazon Interview Questions which is getting unsustainable.

    I'm a newbie & recently signed up for a high speed EC2 instance without being aware of billing works. I was only experimenting with a one off activity in server. It was only when I received the monthly bill I realised the huge cost and the fact that I need to terminate instance after use in order to stop charging. AWS Training USA






    Awesome! Thanks for putting this all in one place. Very useful!


    Grazie,
    Ajeeth

    ReplyDelete