Open In App

Amazon Interview Experience | 6 Months Intern for SDE-1 (On-Campus )

Improve
Improve
Like Article
Like
Save
Share
Report

Round 1(online) :

Consisted of 5 sections:

1) 10 debugging questions

2) 2 coding ques :- i) https://www.geeksforgeeks.org/search-in-row-wise-and-column-wise-sorted-matrix/

                              ii) https://www.geeksforgeeks.org/check-if-a-binary-tree-is-subtree-of-another-binary-tree/

3) Personality questions

4) Logical Reasoning questions

Round 2(Technical 1) – remotely   :

1) Introduced myself

2) 2 coding questions were asked

i) https://www.geeksforgeeks.org/minimum-steps-to-make-the-product-of-the-array-equal-to-1/

Basically you have to find operations to change each non-negative element to 1 & negative element to -1. Count the operations for each element by taking absolute diff. If count of negative numbers is odd and no zeros are there then increase the operations by 2. 

ii) In a binary tree, find a path between 2 nodes. There was a modification that the height of the tree is infinite and the tree is not in memory.

  The structure of tree is like :-       1

                                                   2       3

                                                 4   5   6   7….. We are given 2 long ints as inputs and we return a vector which is path between them.

I discussed with him to go from “node to root” instead of general “root to node”. He asked me how and I found out LCA using map and stack.

  He said the approach is right but he does not want to use map/stack or any derived DS. Use only primitive DS. Solved it using arrays.  I gave a case where the map-stack approach would be more optimized. So he told me to analyze both the approaches w.r.t. time and space and explain why it is so.

Time and space for both approaches were O(log(n)) for the worst case. For average cases and in runtime map-stack would be more optimized and he agreed on it. He asked me to code any of the 2 approaches. I coded the array one as it was simpler to implement. Then he asked if I had any ques and concluded the interview.

Round 3(Technical 2) – remotely : 

No intro, no small talk, straight to coding

1. https://www.geeksforgeeks.org/count-distinct-elements-in-every-window-of-size-k/

  No constraints on k & N and was told to handle all possible corner cases.

  Discussed approach -> coded it -> approved -> discussed time complexity and why it is O(n)

2. https://www.geeksforgeeks.org/convert-a-given-tree-to-sum-tree/

  Explained approach -> she asked which traversal will be used and why -> postorder as we calculate left and right child first and then process root -> coded it -> approved

3. https://www.geeksforgeeks.org/trapping-rain-water/

  Gave the solution with 2 arrays i.e. left-max & right-max. She told me to do it in a single extra array. Did after taking 5 mins. Then she told me to do it in constant space.  

  I didn’t think that was even possible. After trying for 10-12 mins I told her I am getting nowhere. She told me to code the single-array approach.

  Coded it -> had some logical mistakes -> she gave a direction what the error can be and did a dry run together -> solved it after some time and code was approved.

  She told me we have some time to think about how to do it in constant space. 10 mins later, the time was up I did not come up with anything and the Interview was over,

  NO projects, subjects, HR questions

Verdict :- Selected


Last Updated : 28 Sep, 2020
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads