Amazon Interview Experience (On campus 2018)

Amazon visited my campus for Full-Time Software Development Engineer.

Coding Test (Hackerearth):
————————————

1. Around 20 MCQs based on OS, DBMS, Networks, and CPP
2. Two coding questions

  1. Given a string containing only a, b and c. You have to split the string into two parts. Append the left part to the right part and keep removing the characters if they are same at the joint.
    Eg.: let s = "abacacbaa"
    left = "abac", right = "acbaaa"
    ans = "acac"
    
  2. You are given two arrays, A and B. Ai contains the number of candies of type i, and Bi contains the priority of the ith candy. You can’t eat a candy of lower priority before a candy of higher priority, and only one type of candy can be eaten in a day, and the maximum number of candies that can be eaten in a day is given by ‘k’.
    You are given a list of queries containing the candy type and the day. For each query, you have to tell whether or not the given type of candy can be eaten on the given day. Print “yes” if possible otherwise print “no”.

Interview:
————–

Round 1 (35-40 mins):
I was asked to introduce myself, then given 5 minutes time to explain my intern project, and for the rest of the time, the interviewer asked me coding questions.



  1. You are given a string array containing the list of cities, and an API ‘isConnected(string A, string B)’. The API tells whether cities A and B are directly connected (the path is directed) or not. You are given two cities as input. You have to write a function which will tell whether or not there exists a path between the given cities.
    Hint: Build an adjacency list/adjacency matrix using the API, and find out all connected components. If both the given cities lie in the same component, there exists a path.
  2. Given a BST in which two nodes are swapped (values), identify those nodes.
    Solution: GeeksforGeeks Link

Round 2 (45-50 mins):

  1. Explain distributed in-memory computation. (This was based on Big Data project mentioned in my resume).
  2. You are given a string containing [, ], {, }, (, ) and X. X can be any one of [, ], {, }, ( and ). You have to tell whether or not the given string can be converted into a balanced parentheses string by replacing X with anyone among [, ], {, }, ( and ).
    Solution: GeeksforGeeks Link
    Hint: Use backtracking
  3. Given the root of a balanced binary search tree and a number N, tell whether or not there exist two nodes whose sum of values equals N. Space complexity used should be less than O(n).
    Solution: GeeksforGeeks Link

Round 3 (40-45 mins):

  1. Split an array of integers into two subsets of equal average. Return both the subsets.
    Solution: GeeksforGeeks Link
  2. Given a 2-D array filled with 1’s and 0’s. A group of ones that can be traversed completely from any 1’s of that group is called an island. You have to count the number of islands in the given matrix. For a given index (i, j), you can go to (i+1, j), (i-1, j), (i, j-1), (i, j+1), (i-1, j-1), (i+1, j+1), (i+1, j-1) and (i-1, j+1).
    Solution: GeeksforGeeks Link
    Hint: Use DFS
  3. Tell the difference between HTTP and HTTPS.

Round 4 (40-45 mins):
This round was both technical and HR.

  1. I had mentioned DBMS and OS in my resume. Based on that, I was asked to design a database to calculate the ratings of movies like IMDB. He then asked me to make this scalable for a large database. How can I find the reviews of the latest movies (movies released after a certain date)?
  2. Given an array, rearrange the array elements such that it is increasing for the first half and decreasing for the second half.
    Solution: GeeksforGeeks Link

Then, asked me a few HR questions like why do you want to join us, why should we hire you, why did you opt for software field (my branch is Electrical) etc.

Finally, 5 students were selected from my college and I was one of them.

I’m very grateful to GeeksForGeeks, to all the contributors of GeeksForGeeks for my success. I am not a very good competitive coder, but I got confidence by practicing on sites like GeeksForGeeks and Hackerrank. The interview experiences helped me prepare myself mentally for my interview.

Tip: Prepare yourself well for writing code on paper or board. They are going to ask to write a clean code on paper for every question. Just telling the approach isn’t enough. Try to keep the interview as interactive as possible, discuss your approach. If you get stuck, you might ask for some hint. Though one of the interviewers denied (told me that that would reveal the entire solution), but he asked me whether I wanted to move on to another question.

Write your Interview Experience or mail it to contribute@geeksforgeeks.org

Join Free Interview Preparation Course



My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :
Practice Tags :


5


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.