Sunday 29 July 2012

The Amazon Interview Process



This is the crude stuff about how my interview at Amazon went, I did not want to bore my dear friends with it, but then I thought may be someone would find it useful. So this will be one among that few that's just there in my blog but not for my readers to read. This is for that tech crazy job aspiring people who would really find this useful as I found many such blogs useful for my preparations.



Amazon’s interview process is sure one of the toughest to crack, especially since they come with a very specific list of skills. Amazon’s interview process is intended to analyse one on the basis of a set of data points and the cumulative of all data points are taken to find the final result. It must also be noted that if one candidate fails to satisfy the company’s requirement even on one data point he or she will be eliminated instantly.

An Overview of Amazon's Interview process


Amazon looks for the following in any candidate

  • Programming skills
  • Problem solving skills
  • Knowledge of Data Structures and Algorithms
  • Problem identification skills


Amazon’s recruitment/placement process is divided mainly into two parts

  • The preliminary test
  • The technical interviews ( 3 – 4  interviews in the span of a day)

The preliminary test contains both technical and aptitude based questions and it also includes two programming questions that have to be coded in an environment provided by amazon. The primary aim of the programing questions are not to test your ability to produce outputs but the focus is on finding the better answer or the faster easier logic.

The interviews purely focuses on ones ability to solve problems and the depth of ones knowledge in the field of data structures and algorithms. The more important thing is that one should be able to code on paper as they will ask for complete working programs and they wont provide you a compiler to test it on. Further care should be taken when coding for the edge cases as all edge cases will be explicitly tested on your code by them.

The Aptitude / Technical Test

If ones dream of getting into Amazon must come true then it is mandatory that this round be cleared and clearing this is not very easy.

They ask around 20 wildly assorted questions spanning everything in computer science fundamentals and a few from aptitude section as well. One could always expect a few output questions from c and cpp. The only trick is to be through with the fundamentals. The list of questions and their topics I remember will be listed at the end.

Programming Questions

The more crucial part of the preliminary test is the coding section where you will be asked to code  two rather simple programs ( simple in reference to other programs that usually appear for coding contests or online coding tests) within a time span of 45 mins. Though Amazon as such does not explicitly specifies any restrictions with respect to the time and memory conception of the code, they do evaluate by hand the optimality and efficiency of the code to decide whom they should let in to the interviews.

Getting an output is not the primary criteria for getting a safe passage into the interviews. Do take extra care to make sure that a better solution is provided for each problem being asked. One more thing that should be kept in mind is that though the environment accepts your program if it provides the correct output for the provided test case it may not get you to the next round. Make it a point to construct your own test cases and test your code on that too. These should guarantee you a safe passage to the next round.

Again the question that I was asked and I remember will be provided at the end of the so called long prose.
PS: By the way don’t think about copying, they do use dif on  the codes.

The Interviews

I did have to go through a sum total of about 6 hours of interview process before I was selected and it was divided into 3 sessions. First a 45 minutes interview that tested me on problem solving, next was an another 1 and a half hour interview on Data structures and lastly a 3 hour 15 min interview on more advanced and tricky use of data structures, algorithms and problem solving.

The first interview included a warm welcome and two very straight forward questions, It only included a basic understanding of data structures and some very crucial logic to get past this one

The second one was a HR interview and a technical interview rolled into one. The HR questions asked were pretty basic and included questions like, what is your achievements and why amazon so on and so forth. The one thing to be sure about is that you should know your resume back and forth. They have asked me everything that was there on that piece of paper. Again all questions I remember will be appended to the document.

The third interview was the toughest one of all, it was a gruelling three hour process and some tough questions. There were two programming questions again one was really tough and the next was relatively easier which was then followed by lots of direct questions on data structures, more like rapid fire back to back questions round.

Every time they do ask if we have questions and its appreciated that one asks them questions and they do like being asked questions about the company and how work happens in Amazon.

Tips and Tricks

·      Learn to be able to deduce logic for solving a problem and then convert the logic into code. Do follow the distinction between the two. This helps achieve a generic approach to solving adhoc problems. I suggest using of flowcharts to deduce this logic as it helps convert complex logic to code very easily.( It aided me in coming out of the final interview in flying colours).

·       Try programming puzzles in sites like codechef and do participate in coding contests. This helps in developing an appetite  and aptitude for solving programing puzzles.

·         Do study data structures and algorithms very well, they are absolutely necessary for Amazon and do practise such that you be able to identify immediately what databases serves best when used to solve a particular problem.

The Questions

Preliminary

MCQ:

  1. Given a rectangle of given size what is the minimum no of squares needed to exactly cover the rectangle.
  2.  Identify a given algorithm.
  3. Given several pipelines their time costs and the delay in starting each pipeline what is the time taken to execute a certain no of instructions that are depended on each other.
  4. What is the maximum number of processors that can run using 11 resources such that deadlock will not occur.
  5. Which of the following happens ( deadlock and starvation), deduce for the given code.
  6. Several output questions.
  7. One question to identify the suitable characteristics of a network to be used under specified circumstances.
  8. A question for speed distance and time.

Sorry that’s all I can recall.

The two programming questions are

  1. Given that amazon wants to recruit only one from a group of n equally qualified candidates, they have decided to make them all stand in a row and them ask the ones standing at odd places to go home, repeatedly till one exists. Given n by standing at what position shall ensure a sure recruitment by Amazon.
  2. Given a linked list containing a sequence of characters, reorganise the string such that all the vowels appear first and the consonants next and they be sorted in the order they appeared.

Interview Round 1

  1. Given that amazon wants to recruit only one from a group of n equally qualified candidates, they have decided to make them all stand in a row and them ask the ones standing at odd places to go home, repeatedly till one exists. Given n by standing at what position shall ensure a sure recruitment by Amazon. Assume that the list given is  a linked list and all that you will have is the pointer to the start of the linked list.
  2. Print the elements in a n x m matrix diagonally and from bottom to top

Egs   for  a simple 3x3 matrix filled with number 1 - 9 print  7 , 4 8, 1 5 9, 2 6, 3                                                                                         

Interview Round 2

  1. Given a stack add the following feature without changing any of the characteristics of the stack. getminelement() with unit complexity, O(1).
  2. Everything in the resume round.
  3. What are my best achievements and why I consider it my best achievement?
  4. What are my weaknesses and when and how has it affected my productivity?
  5. What are my projects and explain in detail what I did?
  6. Explain how I managed my team and concentrated my teams effort to achieve our aim.

Interview Round 3

  1. Given that the input is a binary tree connect all the elements in the same level or depth using links.
  2. Given the stack what additional modification can you bring to the stack such that you are able to check the presence of an element in the stack.
  3.  Direct questions on Hashing( predominantly )and other data structures.

Additional Questions


  1. To swap adjacent elements of a linked list by modifying only the pointers. 1->2->3->4 becomes 2->1->4->3 and 1->2->3->4->5 becomes 2->1->4->3->5
  2. To sort the elements of a vector. Stable sort. The elements are sorted based on element%7. {1,2,3,4,5,6,7,14} becomes {7,14,1,2,3,4,5,6}
  3. To find number of sequences of the form 1...N such that each element differs from the previous by +1 or +2. N is the input. Bonus: Generate all possible sequences for given N.
  4. An array is given. Each element differs from the previous by +1 or -1. Best way to find the first occurrence of given number.
  5. Given an array of extremely huge size, find the sum of elements from ith index to jth index. There will be lots of queries even for a single array. So some sort of pre calculation is expected.


I just wanted them to ask


lonely : I just wanted them to ask

I just wanted them to ask,
Not bother and bask,
I just wanted them to care,
That is only obvious and fare.
I asked not for a sonnet and a song,
Nor for pretty things to sing along.
All I asked for was love,
And none is what I got till now.
I asked not was cages of gold,
But the tight grip of your hold.
I want not the glitter of your smile,
But for you to be not apart a mile.
I asked not for divine embellishments,
But for wet trace of your rosy armaments.
The love is dead, that I know,
But life that is mine is being lost in snow.
In white and in black you tread,
In things you say are far important than the bread.
Care, do you really?
Love, hope you could see fairly.
Such is the loss that I dearly know,
That it is so much for me to let go.
Love me, care for me I beg,
It won’t cost you an arm or a leg.
I just wanted them to ask,
Not bother and bask,
I just wanted them to care,
That is only obvious and fare.

This is for D, who was pestering me lot to make a poem happen! So here it is , I fulfilled my promise :D

Friday 6 July 2012

Chasing Liberty



The idea of liberty and freedom has always been more than just words to our years, we have had undergone a grueling struggle to claim what we call our freedom. Enrich Freud, an eminent psychoanalyst points out that humanity always had a quest fro freedom but often it were  reduced to nothing but replacing an archaic system of suppression with a later model. The continuous changes in governance and  theosophical societies has played the major role in what is that we call freedom. As mush as I agree with him on this point I disagree to the same degree with his views. I know that could very well be called double standards but after all for us Freedom , Liberty and democracy are more than just words.


All men are born freebut everywhere they are in chains

                                    -Jean Jacques Rousseau



The idea of liberty and our chasing behind it is there in the very fabric of our existence. As Rousseau  invariably pointed out all most all men are born into chains though by entitlement they deserve none, they are born into the chains of society, the chains of relations, the chains of hypocrisy and the very chains of existence. Though one may argue that some chains are rather light and essential for a social being, I would like to point out that nevertheless they are chains and further more an encroachment on ones freedom.  However light the chains may be, however indistinguishable the reins may be, they are by all degree an hurdle in the quest for absolute freedom.

Absolute freedom mocks at justice. Absolute justice denies freedom.

                                                                                                                                - Albert Camus


The absolute freedom is as volatile a thing as anything can ever be. When a freedom so absolute arrives and is exercised in its purest form, wouldn't ones freedom be just another encroachment on another's, wouldn't one's freedom be a hindrance to another's. These questions pose an obvious answer, it certainly would. if you are still unclear on that let me put it with a light example out here. if my freedom allows me to kill somebody as it should as it is being purely nonrestrictive to me then that becomes an encroachment one that persons freedom to live with out any fear or danger whom I am to kill to exercise my freedom. That must simply make it clear that our quest for absolute freedom will never be quenched as there can never exist an ideal concept of absolute freedom that is exercised universal and without discrimination. 


Then what are we hunting when we are hunting for freedom? what really is freedom? is it an ability to do what ever we please when ever we please to do so? It is not! Freedom in its ideal form is just an act of balance where one can do what he pleases as long as he is never incriminating another's right to do what that persons feels to do. Freedom sure is a strange idea, so is Liberty. I would never talk of democracy as an idea as strong as an idea as liberty or freedom. Democracy is just another "cracy", much like autocracy, theocracy and so on. 


The God who gave us life, gave us liberty at the same time.

                                                                                                                - Thomas Jefferson


But Liberty and Freedom are profound ideas and things that ever human or rather animal soul craves. But then one might ask what difference Liberty and Freedom entails as they seemingly and essentially appear the same. In fact its true that they are identical but for a slight difference. Liberty is the ability to exercise freedom without harming another.  It is true that our should never be for absolute freedom but for absolute Liberty and only the lady of liberty can bring about such profound change in humanity that they stop existing as a coercive species and as groups of idealists. 


The quest for freedom or liberty what ever it may be is a long one and much is left to be done to attain this perfect balance. what we need now are not champions of democracy nor champions of liberalization but we need champions of liberty. Champions who can and will work to bring about absolute Liberty. A liberal world is the most perfect world that we can ever hope that our children will ever live in. 

Dreaming of such a wonderful world I stop her assuming that from the shreds of things I talked about you could find what is that you want from the freedom and liberty you already have and what is that space that you want to create for liberty to thrive.

Tuesday 3 July 2012

The Nights of the Firefly



Fireflies in a jar


The monsoon has just took an hiatus after barging on my window silts for what seemed like hours, the night still resounded with the faint dripping of the raindrops, yet there was an unusual silence about the dark veil it wore. The cold night which was reeling under the rain was just released and like a convict freed from the prison, it took in a deep breath, a profound, prolonged breath. The tress swayed and banged their heard on my bedroom walls. The night was poignant and yet there was one visitor who was not gloomy, one who was high in spirit, dancing around with a limy lantern on her tail.


Every monsoon she had came to visit me, day in and day after and this rainy night was no different, betwixt the occasional lashing of the coconut palms and the slow insidious murmur of the cricket. Slowly gliding into the darkness of my room, the strange ghostly lights, yellow, green and fluorescence of the chemical light, as though she in her gentle palanquin. She swayed and she glided, she smiled and she frowned and she sat on my bed with child-like innocence. A creature so pure, so beautiful, that her faint yellowish green glow has filled up more than just a room, it has filled my heart, the gentle sublime firefly!



“The fireflies o'er the meadow In pulses come and go.” 

- James Russell Lowell




Have you ever seen a lake at night filled with fireflies, if you have not then you have seen nothing. The beautiful sight of floating lights that embellish the nights in a festive canopy, they go on and off in a blaze with subtle demeanor. My room was filled with them many a times, gaining shelter from the tormenting rain that just went by they came in. I do keep my windows open and welcoming, they are never closed and hence I do have a large number of visitors day and night and my little friends here were more than just acquaintances. They would sit at the various places that they felt comfortable, transforming my room clad in darkness into a sight as serene as the night at the lake.


fireflies at night


But Alas! the times have changed and changed a lot too, the lantern like angels do not come visit anymore, the night skies are darker than the used to me, shrouded by darkness and the pessimistic cacophony of the rumbling concrete jungle on the rise. The fireflies have long been gone, but even today as the rain battles on my walls, trickling and spraying off my window rails, I dream of the lake, the dark, the blue, the silent lake filled with a million tiny sparks in the starry sky.