Friday, July 14, 2006

Amazon Interview Round 4

Round 4:

It was again telephonic with one of the top shots. Also the last of the marathon.

Q 1: There are two linked lists. You need to find if there is a intersection in these lists. By intersection what he meant was that if two link lists merged at some point.

Q2: After solving the above he asked me the node at which they will merge.

Q3: Given a graph , you are given a particular node and asked all the node which can be accessed from this node and all node which can access this node. (Directed graph)

Q4 : If 2nd October 2001 was a palindrome : 10022001 which date before this was palindrome?


Mail me if you find some problem solving the above.

Amazon Interview Round 3

For third round they flew me down to Chennai and there I had four rounds:

Round 1 : This round went for approx 1 hr.

Q1:
They asked me about the product i was working on. They asked me if i would have the creator of the product what design patterns i would have used? What are the loop holes in this design? blah blah blah. I think these questions were more on the specific project than on generic interview as such. but this was the only interview where i was asked about Synchronization, threads and other java/j2ee stuff.

Q2: If you have been given a currency format which is of the American standard then how will you write a regular expression for the same. the format examples $110,000,000 or $1,000,000.
Solution: Though I didn’t know much of regular expressions and to start with i wrote more of finite automata machine than regular expression, but in the end I was able to produce the desired result.

Q3: Pre-order of a binary tree without recursion?
Solution: Easy solution by using stacks.


Round 2 : This round went for approx 1.5 hrs. This was one of the most amazing rounds. It started with all amazing stuff on what I do , I read, my hobbies , if i am self motivated on reading about new technologies if yes then what and so on so forth. I think I solved just one question. And total duration was 1.5hrs!!!

Q1: You are given a tree and a pointer to one of its node.
One can call lock or unlock functionality on this node.

LOCK : There can be two outputs to this method "lock" i.e. true when we were able to lock this node and false when we were not able to lock this node. The condition is that if the node which needs to be locked has a parent which is already locked then one can’t lock that node. Also if any of its successors are locked then also one can't lock that node.

UNLOCK: If that node is locked then unlock it.

Now we need to store some information in the nodes. So I was asked to design the data structures of the nodes which will be helpful to me to store information.

Then this question went on from binary tree to n-ary tree.

Solution: Will be posting soon.

Round 3 : This was the great round. Loads of questions. Lot of brain-storming and i think it was a mix bag in end. But I think i gave each and every question a nice shot and that might have effected my results.

Q1:

Q2:

Q3:

Round 4:


Q 1: Difference between inner and outer join.

Q 2:
One puzzle. Your are participating in a game show. It has three doors, which have a goat, a dog and a merc behind them. Now you have select one door. It is kept closed. Now the anchor selects one door. He makes sure that it is not the one which has merc behind it. Now you are given an option to go with the your first selection or select a new door. What will you do?
Solution: I will select a new door. He asked why? I explained using probability.

Q 3: To calculate number of petrol pumps in Chennai.

Amazon Interview Round 2

The second round was also telephonic. It went for almost 1.5 hours though scheduled for one hour. The main reason for that i think is that i was solving questions and each time i was asked to re-look at the solution I used to improve it further.

Question 1: Shuffle pack of cards
Solution 1: It is one of the most common questions that are being asked in Amazon (Though I came to know this only after the interview:-D). I started with using Sets again but the complexity turned out to be very bad. I assumed that there is a random function with time complexity O(1) and I call this random function to get values from 1...52. Once i get that random function i will add that value in a SET. So in end I will have all the numbers from 1...52 in a random fashion. The catch in my solution was that if the random function returns number x, m times than for each number we will call this function m times and for 52 numbers it will be (m power 52). This is huge. I tried giving another solution but was no better. In the end he moved to next question. Check out here for solution.

Question 2: Count number of lines, characters and words in a file (Given that we don’t have much access to flashy java methods like readline, String methods like indexOf etc.)
Solution 2: The constraint given above simply means that one has to read character by character. I started with a basic program of reading character by character and passing that character to switch statement and doing some logic when ever i got ' ' , '\t', '\n','\r' . But the problem with this solution was that whenever i used to get some odd input like empty file, a file with just '\n' or a file with just a space then i used to patch my earlier solution. Then as i was giving solutions to problems i was asked if I could store some "state". I tokk that lead and provided another solution: -

Store a "state" variable. i.e. when ever a NON- special character (i.e. character apart from ‘ ‘ , ‘\n’ , ‘\r’, ‘\t’ , EOF comes then make the state 0. Whenever a special character comes make state 1. So whenever we go from state 0 to 1. Increase word count. Whenever we get \n or EOF we increase line count. And each time we increase character count.
After this solution no clarification was asked for.

Question 3: Write USE case for Auction model where you have a seller, an item and a buyer.
Solution: This was more generic design question and was just asked to write use-case. Not seq diagram etc.

Learning points 1: Have a nice grip on time complexity. They will make you calculate for each of the solutions you give.
Learning points 2: Concentrate real hard for that 1.5 hours and if you are not clear of the problem then don't hesitate in asking it again.
Learning points 3: You will be asked to write proper code.(even you will be asked to communicate the same through phone)
Learning points 4: The questions will be very generic and never specific to some language.
Learning point 5: Used a variety of test cases to check one's solution before presenting the same to interviewer.

Black and White

I dont think this post needs any description. Just follow the below link.

http://picasaweb.google.com/saurangshu/LifeInBlackAndGray

Too good. Cameraman : Saurangshu Pandey , Manager Oracle IDC

Thursday, July 13, 2006

Amazon Interview(Round 1)

Recently I under went Amazon interview and have received the offer letter.
Following are the details of interviews.


Round 1: Telephonic

I think my first round was more of patience than of intellect. Interview was fixed three times. I was made to wait for 1.5 hours each on first 2 instances and finally was interviewed on the third time. Round1 went for 45 minutes.

Question 1:
Resume walk through, mainly concentrated on my latest project. Asked me my best and most challenging project and the questions revolved around those.

Question 2: Intersection of two arrays. Though he reframed the question but the basic point was that I was given two arrays and I have to find singe array which is intersection of the 2 input arrays.
Solution: I used Java set collection and gave a decent explanation then i was asked to write code for that.

So the above 2 questions took full time. The basic points of the first round were to be very much clear about what one has written in resume. Also be ready to write some proper code (in whatever language you prefer)

Tuesday, June 20, 2006

Scrapping made easier

If Logging into Orkut troubles u or u are as lazy as I am to scrap back then look at this tool.. This tool converts srapping work to messenger :)

http://www.scrapboy.com/en.php

Saturday, June 10, 2006

For Ronaldinho Fans

With world cup fever on. This is a perfect video for all Ronaldinho fans to start with.

Network neutrality

If you are not aware of this then you will feel its presence in future when your website will take more time to download than those who pay premium to Internet Service providers. Its sad but it is true.

Network neutrality is the notion that networks should not distort application traffic by delaying, dropping packets. For details visit wiki. It's a buzz word going across globe and even the most searched for word according to google current.
Even the US congress had a hearing on the same on November 8th.

So search more and get enlightened.

Google Current

For those who dont know what google current is :-

Google Current airs every half hour on Current TV and provides a look at what the world is searching for on Google.

It is really amazing to know that what people are searching and really increases one's horizon of knowledge too.
As for me i added net neutrality to my knowledge through Google current. Also an Indian will be amazed to see this on google current.

As far as anchors go , i feel Conor Knighton is much better than Kinga Philipps (no doubt tht Kinga is cute :) )

So keep watching what world is watching. have fun...

Friday, June 09, 2006

Season of sharing-5

With Google and yahoo competing against each other i think i have to share things on daily basis. There are 2 new things this time:-

1. Google Sketch
BEWARE mechanical engineers. Now with Google’s help even a Software engineer can design which mechis used to design in CAD/CAM. Check out this tool: http://sketchup.google.com/ . This tool is really simple and helps you to design ur home :) ...happy googling....

2. Yahoo's home page
Now after yahoo's mail client; yahoo has changed the look of their home page as well. It’s worth looking at. Access your mails/messenger/city climate/groups at a click and with AJAX technology :). After Google now yahoo is new AJAX fan :)