Amazon Interview Experience | Set 265 (On-Campus Internship)
Last Updated :
09 Aug, 2024
Amazon recently visited our campus for hiring interns for 6 month internship.
Round 1: Online Test
The round-1 was an online test of 90 minutes. It was hosted on HackerRank platform. There were 20 MCQ questions and 2 coding questions. MCQ questions were of 1 mark each. There was a negative marking of 0.25 for each wrong MCQ answer. The MCQ questions were from data structures, DBMS, aptitude, etc.
The coding questions were:
Q1. Reverse words in a given string
Q2. Possible words from Phone digits
Note: It is very important to do atleast one coding question to clear this round. Even if you get all your 20 MCQs correct but you donât do any coding question then your chances of getting selected are very low. I suggest everyone to do all the MCQs they can in initial 30 minutes and then devote last 60 minutes for coding questions.
I did 15 MCQs and 2 coding questions. I got selected for next round. Overall, 19 students got selected for next round.
Round 2: Interview
The interviewer first asked me about one of my project that i mentioned in my CV. Then he asked me two questions.
Q1. We are given a mapping: A is mapped to 1, B is mapped to 2, C is mapped to 3 … Z is mapped to 26. We are given a number n, we have to tell how many distinct strings can be formed from this number n using the given mapping. For example,
Input: 121
Output: 3
Explanation: We can read the number n as 1, 2, and 1. The string formed will be ABA (1=A, 2=B). We can also read the number n as 12 and 1. The string formed will be LA (12=L, 1=A). We can also read the number n as 1 and 21. The string formed will be AU (1=A, 21=U). So we can form maximum 3 distinct strings out of number 121 using the given mapping.
I gave a recursive solution and the interviewer was satisfied with my solution. So he asked me to code my solution on a paper. I coded the solution and then he checked my code. Once he was satisfied, we moved on to the next problem.
Q2. https://www.geeksforgeeks.org/remove-bst-keys-outside-the-given-range/
After a while the shortlist was announced. 10 students got shortlisted for the next round. I too got shortlisted for the next round.
Round 3: Final Interview
This was the final interview of the process. The inteviewer first asked me to introduce myself and then he asked me about one of my project. He then asked me several questions, which are as follows:
Q1. What is a binary tree? What are different types of traversals in a BT? What is the difference between these traversals? Which of the traversal is based on BFS and which is based on DFS?
I answered the questions appropriately. He was satisfied with my answers.
Q2. Level order traversal in spiral form
Once i gave him the solution, he asked me to code it on a paper. He checked my solution manually with some test cases. Once he was satisfied, we moved on to the next question.
Q3. What is a max heap? What is a min heap? What are some real life applications of heaps?
Q4. How to insert in a heap? What is the time complexity?
Q5. How to delete a min element from a min heap? What is the time complexity?
Q6. Given an array of n numbers, how can i build a min heap from the array. What is the time complexity?
I answered him appropriately. I told him that we can solve the above problem in O(n) time complexity. He then asked me to prove that the complexity is O(n). I proved it with an example array. He was satisfied with my answer.
Q7. There is a constant flow of numbers coming in from some infinite list of numbers out of which you need to maintain a data structure as to return the top 100 numbers at any given point of time. Assume all the numbers are integer numbers only.
Sol: I gave him a solution using min-heap. We can create a min heap of 100 elements. The first 100 elements is easy to handle. Let say we get the 101th element in the list. If this number is less than the root of the binary heap then we need not do anything. If this number is greater then the root of the binary heap then we need to replace the root element with this element and call percolate-down procedure on the root of the binary heap.
My interviewer concluded my interview with this question.
I suggest everyone to go through Amazon interview experiences of atleast 5 people from geeksforgeeks.com before their Amazon selection process. Finally, i would say focus on data structures, OS, DBMS and networks. In data structures, focus mainly on binary trees, binary heaps and linked lists.
Related Practice Problems
Similar Reads
How to Convert a String to ArrayList in Java?
Converting String to ArrayList means each character of the string is added as a separator character element in the ArrayList. Example: Input: 0001 Output: 0 0 0 1 Input: Geeks Output: G e e k s We can easily convert String to ArrayList in Java using the split() method and regular expression. Paramet
1 min read
Scala SortedSet mkString() method with a separator with example
The mkString() method is utilized to display all the elements of the SortedSet in a string along with a separator. Method Definition: def mkString(sep: String): String Return Type: It returns all the elements of the SortedSet in a string along with a separator. Example #1: // Scala program of mkStri
1 min read
Scala Set mkString() method with a separator with example
The mkString() method is utilized to display all the elements of the set in a string along with a separator. Method Definition: def mkString(sep: String): String Return Type: It returns all the elements of the set in a string along with a separator. Example #1: // Scala program of mkString() // meth
1 min read
Scala Stack mkString() method with a separator with example
In Scala Stack class, the mkString() method is utilized to display all the elements of the stack in a string along with a separator. Method Definition: def mkString(sep: String): String Return Type: It returns all the elements of the stack in a string along with a separator. Example #1: // Scala pro
1 min read
Scala List mkString() method with a separator with example
The mkString() method is utilized to display all the elements of the list in a string along with a separator. Method Definition: def mkString(sep: String): String Return Type: It returns all the elements of the list in a string along with a separator. Example #1: // Scala program of mkString() // me
1 min read
Scala TreeSet mkString() method with a separator with example
The mkString() method is utilized to display all the elements of the TreeSet in a string along with a separator. Method Definition: def mkString(sep: String): String Return Type: It returns all the elements of the TreeSet in a string along with a separator. Example #1: // Scala program of mkString()
1 min read
Scala Queue mkString() method with a separator with example
The mkString() method is utilized to display all the elements of the queue in a string along with a separator. Method Definition: def mkString(sep: String): String Return Type: It returns all the elements of the queue in a string along with a separator. Example #1: // Scala program of mkString() //
1 min read
Scala immutable TreeSet mkString() method with a separator
In Scala immutable TreeSet class the mkString() method is utilised to display all the elements of the TreeSet in a string along with a separator. Method Definition: def mkString(sep: String): String Return Type: It returns all the elements of the TreeSet in a string along with a separator. Example #
1 min read
Scala List mkString() method with a start, a separator and an end with example
This method is same as mkString() method but here a start, a separator and an end is also included. Method Definition: defmkString(start: String, sep: String, end: String): String Return Type: It returns the elements of the list as a string along with a stated start, separator and an end. Let's chec
1 min read
Scala Iterator mkString() method with a separator with example
This method is same as mkString() method but here a separator is included. Method Definition: def mkString(sep: String): String Return Type: It returns the string representation of the stated collection with a given separator. Example #1: // Scala program of mkString() // method with a separator //
1 min read
Scala Iterator mkString() method with a start, a separator and an end with example
This method is also same as mkString() method but here it is accompanied by a start, a separator and an end. Method Definition: def mkString(start: String, sep: String, end: String): String Where, start is the starting string, sep is the separator string and end is the ending string. Return Type: It
1 min read
Scala Map mkString() method with a start, a separator and an end with example
This method is same as mkString() but here a start, a separator, and an end is also added. Method Definition: defmkString(start: String, sep: String, end: String): String Return Type: It returns the elements of the map as a string along with a stated start, separator and an end. Example #1: // Scala
1 min read
Scala Map mkString() method with a separator with example
This method is same as mkString() method but here a separator is also added. Method Definition: def mkString(sep: String): String Return Type: It returns the elements of the map as a string along with the separator between them. Example #1: // Scala program of mkString() // method with a separator /
1 min read
Scala SortedSet mkString() method with example
The mkString() method is utilized to display all elements of the SortedSet in a string. Method Definition: def mkString: String Return Type: It returns a string containing all the element of the SortedSet. Example #1: // Scala program of mkString() // method import scala.collection.immutable.SortedS
1 min read
Scala Set mkString() method with example
The mkString() method is utilized to display all elements of the set in a string. Method Definition: def mkString: String Return Type: It returns a string containing all the element of the set. Example #1: // Scala program of mkString() // method // Creating object object GfG { // Main method def ma
1 min read
Scala List addString() method with a separator with example
This method is same as addString() method but here a separator is also included. Method Definition: def addString(b: StringBuilder, sep: String): StringBuilder Return Type: It returns the elements of the list to a string builder along with a separator between them. Example #1: // Scala program of ad
1 min read
Scala Stack mkString() method with example
In Scala Stack class, the mkString() method is utilized to display all elements of the stack in a string. Method Definition: def mkString: String Return Type: It returns a string containing all the element of the stack. Example #1: // Scala program of mkString() // method // Import Stack import scal
1 min read
Scala Map mkString() method with example
The mkString() method is utilized to represent the elements of the map as a string. Method Definition: def mkString: String Return Type: It returns the elements of the map as a string. Example #1: // Scala program of mkString() // method // Creating object object GfG { // Main method def main(args:A
1 min read
Scala SortedMap mkString() method with a start, a separator and an end with example
This method is same as mkString() but here a start, a separator, and an end is also added. Method Definition: defmkString(start: String, sep: String, end: String): String Return Type: It returns the elements of the SortedMap as a string along with a stated start, separator and an end. Example #1: //
1 min read