Amazon Interview Experience for SDE-1 | Amazon-WOW 2020
Amazon has a special program called AmazonWOW for women. It is to promote women in technology. It is a very good opportunity for women as they have to only compete with other females, not with males. The online application came in April. The program consists of a two-month internship for prefinal year student and fulltime plus Internship for final year student.
It consisted of a total 4 rounds, first was an online coding contest and then 3 telephonic interviews.
Online test :
The first round was an online coding round. It consisted of 2 coding questions and 28 MCQ. We had 1.2 hrs. The coding questions were quite simple but MCQs were very difficult. I would like to say that luck matters a lot in cracking online coding round.
1. First question: Find the longest common subsequence between two string. It is standard Dynamic programming question but the constraints were not very high so I solved it using recursion.
2. Second question: I did not find the exact question on any platform but it was very simple. You are given a string consisting of lowercase English alphabets, return the internet resource address of the string.
Internet resource address of a string is defined as
<protocol> can be either http or ftp.
<domain>is a string consisting of lower case English alphabtes.
<context> is a non mepty string of lower case English alphabtes.
Ex : httpsunrux -> http://sun.ru/x
For MCQs, you must have a strong grip on OOP and c++ language.:
For this round, I was given an amazon chime link and live code editor link in which I had to code. The interviewer started by asking me my introduction and then he gave his introduction. In my introduction, I told him about my passion for competitive coding, writing and reading.
Then Immediately we moved to coding questions. He told me that I have only 45 minutes to answer so I have to come up with the best approach possible.
1. First Question: Find x ^ y mod z. I gave him the O(log(y)) approach. I covered all the edge cases when x will be zero or negative when y will be zero or negative. When y will be negative, he told me to return an error to the user. I coded properly using indentation and suitable variable and function names. I used int to store the variable but when the value is very high I should use long long int. I missed this case. He then moved to the second question.
2. Second Question: Given a set of dependencies I have to find one of the suitable ordering of the dependencies. I told him I will use topological sort for this. He told me to explain my approach and then I coded it. But while coding I missed an edge case when there will cycle in the dependency. He told me to correct my code. I corrected my code by checking if there is a cycle present in the dependency.
3. Third Question: For this question, I gave him two-approaches, first one was linearly counting the no of x and second was using a modified binary search. He did not ask me to code this question.
The best part was that I had already solved all these questions before so I did not get nervous there. In the end, I asked him where I can improve, He told me to check code before finally submitting to the interviewer.
After 12 days the result of this round was declared.
For this round also, I was provided with the Amazon chime link and live code link. The interviewer asked me two questions.
1. First Question: Add all greater values to every node in a given BST. I gave him O(n ) time complexity solution. Initially, I had written the wrong code but my approach was right. He dry ran my code, pointed out the mistake that I made in code and told me to correct the code. I corrected the code and he was satisfied by my approach. I told him about the time complexity ie O(n). I told him if we consider internal stack then space complexity will o(n) because in the worst case the height of BST can be O(n) if it is skewed BST.
2. Second Question: But in this question, He gave me three conditions.
1. You can traverse the data structure in only one direction.
2. You cannot use extra space ie in-place algorithm.
3. You can use any data structure of your choice.
My first approach was to use an array data structure. I told him that in first traversal I will find the count of negative numbers and then I will start filling my result array. But he said I cannot use extra space.
My second approach was to use a binary search tree and the result will be inorder traversal of the tree. But he told me that I have to return the data structure which I am using.
Then He asked me what are the data structure that I know. I told him I know heap, queue, stack, singly-Linked list and doubly linked list. Then suddenly doubly-linkedList came to my mind and I told him I will use doubly LinkedList. He told me that in doubly-linked you can traverse in both directions. Then I told him that will use a singly linked list. He told me to write code and dry ran my code. He was satisfied with my code.
My second interviewer was a very helpful and knowledgeable person. In the end, he said “it was nice to interview you. ”
After 11 days the second-round result was declared.
For this round also, I was provided with the amazon chime link and live code link. The interviewer was a very nice and chill person. He tried to make me comfortable. He introduced himself and then I gave my brief introduction. In this round, I was asked two questions. One was a coding question and the other was OS( operating System ) question.
1. First question: If we have a well-optimised code, On what factors the maximum no of threads in a process depends?
We had around half an hour discussion on this topic. I told him how threads are used in the client-server application, use of threads in a text editor which simultaneously performs writing, auto-correction and suggestions. He asked me if a site has 1 million clients, then 1 million threads will be created, I told him about the use of multiple servers. I told him the no. thread depends upon the resources of the machine. I told him it will depend upon the memory of the computer. Then He wanted to know, which memory affect it, primary memory or secondary memory. I told primary memory will affect the no of threads as all the processes/ threads reside in the primary memory. I was thinking of other factors also but then he moved to coding question.
After this, we moved to coding question.
2. Second Question: Find the first missing positive number in an array.
My first approach was to use hashing, the time complexity of this approach was O(n ) and the space complexity was O(n). He told me to do it in constant space. I suggested to him that whenever I will encounter an element and if it is smaller than n, then I will make element negative at that index. Then I will traverse the whole array again and if I find any index whose value is non-negative, its means that element is not present and it is the first missing positive no. If no such no. is found then the answer will be n ( size of the array ) + 1. But this approach will not work for an array containing negative and repetitive no. So I improved my code to handle the negative and repetitive no.
He was very much satisfied with my approach. In the end, he asked me to ask a question to him. I asked him how can I improve more. He seemed to be very much impressed by me. He told me that I am very sharp in handling all the edges cases and I am very focussed.
Some important tips:
1. Always believe in your self.
2. Communication skills matter a lot in the interview.
3. Luck is an important factor, you can not ignore it.
4. Always be positive in life. No matter how difficult the situation do not give up.
5. Practise and patient is the key.
Please Login to comment...