Coders Funda - Online Tutorials Point

Coders Funda - Online Tutorials Point

Amazon interview

Round 1: Online Coding
  1. A variation of  Minimum time to rot all oranges.
  2. Evaluating top N Competitors of Amazon echo from reviews received by Crawling websites.
Round 2: DS & Algo


  1. The square root of a number 
  2. Bottom view of a BT
  3. Some situational questions like a situation where you came up with a quick solution to save time.
Round 3: DS & Algo
  1. Design a Data Structure that supports Insertion, Deletion, search and getRandom in constant time.
  2. Print nodes at k distance from root
  3. Some situational questions like a situation where you were helped out a colleague, etc
Round 4: Design Round (SDE 2)
  1. Design an IP Blocking system. Asked for multiple approaches along with their pros and cons
  2. Design a Logger.
  3. Why Amazon?
Round 5: Hiring Manager Round (SDM)
This round mainly focuses on presenting situations that test the candidate’s compatibility with Amazon. Strong Leadership and Ownership principles are the focus. You will be asked a lot of situational questions like
  1. Brief Introduction
  2. Innovative solutions you came up with in your previous company.
  3. Conflict with manager
  4. A situation where a colleague helped you out.
  5. How did you handle tasks with a strict deadline?
  6. How do you go about approaching a new task at hand?
    etc.
Round 5: Bar Raiser
  1. Brief Introduction
  2. Design a Job Scheduler. Drawbacks of the system I designed. How to implement a recurring job? Further optimizations.
  3. Situational questions like the biggest technical challenge I faced, A situation where I had to fix someone else’s bug, etc.
-------------------------------------------------------------------------------------------------------------------------
First Round –
I don’t remember those questionsr but there were one easy, medium and last one related to Oops concept implementation.


Third round –
In this round only 2 problems were asked:-
1. Remove unnecessary brackets from expression
ex: input (a+b)+((c+d)) and output should be (a+b)+(c+d).
2. Find the longest sub string length which is in Alphabetical order.
ex: input “cfaxy” and output should be 3(axy).
interviewer was expecting code without any bugs so be careful.
Fourth round –
1. Interviewer asked me about my projects.
2. Behavioral question- tell me any situation where you completed your task under lack of information.
3. Find a missing number in range of 1 to n.
4. Gave me a code snippet and asked me to find error.
For every coding question I was asked time and space complexity too.

----------------------------------------------------------------------------------------------

Online Test:
The first round contain easy to medium questions. The online test consists of 28 MCQs in which there were general aptitude questions, OOPS, output, Data structure etc. In addition to this, there were 2 coding questions.
Q1). https://www.geeksforgeeks.org/counting-inversions
Q2).Find the position of leftmost and the rightmost set bit, also the number of total set bits.
Tips– Complexity doesn’t matter in this round, O(n2) solution is acceptable. Also STL works well.
After this there are 4 Technical Online Interviews.
Round 1:


Q2). Find the strings from an array which are not prefix of any other string. (He want the optimised trie solution with full Trie implementation).
Round 2:
It is also a coding round consisting of two coding questions.
Round 3:
This round is based on knowledge about subjects and 2 coding questions are asked. At first he asked me about my favourite subject I said Data Structure then he asked me basic questions about the complexity and type, and questions related to Cache(Very Important).
Round 4:


It was both behavioural and technical round. Amazon focuses more on their Leadership principles. Questions related to that were asked. For Example:-
  1. Describe any situation when your judgement/idea had a great impact.
  2. Describe any situation when you took initiative.
  3. What will you do if you are given a deadline and it’s not possible to complete that project with that deadline.
  4. Describe a situation when your teammates did not agreed with your idea.
Many more questions were asked. The interviewer want me to give answers specifically related to software only.
Two coding questions were asked-

---------------------------------------------------------------------------------------------------------------------

Online Assessment:
The test was conducted on mettl platform.
It was divided into two parts:
  1. First section consisted of gate level C, DS and algo based MCQ questions.
    • Second section consisted of two coding questions

    • First question was based on Kadane’s algorithm
    • Second  question was a medium level logic based question
Interview: Out of 690 students only 57 were selected for the final
interview process.
Round 1:
Round 2:
---------------------------------------------------------------------------------------------------

Round 1 (Online Test, Hackerrank):
  1. [Medium] A big problem statement, it was very similar to Rotten Oranges Problem. Instead of orange, there was a file that needs to be transferred across all systems represented in the matrix.
  2. [Easy] Problem statement demanding to sort the array of custom objects with a custom comparator based upon the use case of the problem.



Round 2 (F2F, Technical):
  1. Next Greater Permutation
  2. I did a project on the internals of Java Reflection and Classloading, the interviewer was interested in the entire architecture and implementation.
  3. Leadership Questions, when was the last time you realized the importance of a good leader

Round 3 (F2F, Managerial & HLD):
A use case of B2B business where Amazon would be onboarding multiple companies in its platform. Each company has some characteristics (CompanyInfo Partner) that are used to rate them and we have “n” partners that can provide those characteristics via API. Each CompanyInfo partner returns some different sets of fields (though contributing to the same factor). Rating is used to provide additional services to the partner. Design a system where all of such partners and companies onboarding would be seamless. At any time, he should be able to query the system basis any characteristics and filters (revenue, numberOfEmployees, etc). He wanted to understand how do I generify the whole vague problem statement and ask doubts regarding the same with him. We had an exhaustive high-level discussion of microservices that I would be putting up.
There were behavioral questions as well.

Round 4 (F2F, Technical, LLD):
Design a feature in Google search which returns “k” most visited websites at any point in time from a log server. A log server provides a trigger whenever a particular website is visited. Low-level implementation is an extension of K most frequent elements in an array. I started off with sorting and moved to Heaps, took me time to get there after struggling. I was asked to write APIs for each operation considering this feature and all design principles that were involved in the design.
Discussion of concepts of MicroServices, Monolithic system, Singleton pattern, Immutability.



Round 5 (F2F, Technical):
  1. Word Ladder Problem. I was then asked to optimize queries if dictionary is constant. I cached the Graph and ran BFS for each query.
  2. Extension on previous problem, he wanted production ready code with suitable methods, method signatures, classes for consumption. He wanted to see if I can write readable, and extendable code.
  3. Questions on Amazon leadership principles
    1. When was the last time when you had to compromise a requirement due to lack of time.
    2. Last time you couldn’t deliver on time.
A week later a got a call for last round (Bar Raiser).

Round 6 (Video Call, Bar Raiser):
This round was completely behavioural round. Inclusive of questions about work that I have done in current organization.
Some of the questions that I remember are:
  1. A contribution that you are proud of and made a big impact.
  2. A case when you had a conflict with your manager or lead regarding a design.
  3. A case when you messed something up and how did you handle it. How did your manager respond to this?
  4. Something that you learnt working closely with your manager.
  5. Why Amazon?
------------------------------------------------------------------------------------------------------------

Online Test:
The first round contains easy to medium questions. The online test consists of 28 MCQs in which there were general aptitude questions, OOPS, output, Data structure etc. In addition to this, there were 2 coding questions.
Q1). https://www.geeksforgeeks.org/counting-inversions
Q2).Find the position of leftmost and the rightmost set bit, also the number of total set bits.
Tips– Complexity doesn’t matter in this round, O(n2) solution is acceptable. Also STL works well.
After this there are 4 Technical Online Interviews.
Round 1:


Q2). Find the strings from an array which are not prefix of any other string. (He want the optimised trie solution with full Trie implementation).
Round 2:
It is also a coding round consisting of two coding questions.
Round 3:
This round is based on knowledge about subjects and 2 coding questions are asked. At first he asked me about my favourite subject I said Data Structure then he asked me basic questions about the complexity and type, and questions related to Cache(Very Important).
Round 4:


It was both behavioural and technical round. Amazon focuses more on their Leadership principles. Questions related to that were asked. For Example:-
  1. Describe any situation when your judgement/idea had a great impact.
  2. Describe any situation when you took initiative.
  3. What will you do if you are given a deadline and it’s not possible to complete that project with that deadline.
  4. Describe a situation when your teammates did not agreed with your idea.
Many more questions were asked. The interviewer wants me to give answers specifically related to software only.
Two coding questions were asked-
--------------------------------------------------------------------------------------------------------------

Round 1(HackerEarth):
Q1. You need to find out the longest subsequence of a string from a given string such that the absolute difference between two alternating characters of the subsequence is less than K.
Q2. You are on an infinite graph and starting from (1, 1), you can move either (x+y, y) or (x, x+y) and you need to find out whether you can reach the given point or not.
Q3. Given a set of numbers, you need to find out the number of ways you can divide the set into two groups such that no two groups are left empty.


Round 2:
Q1. Given two strings containing a special character ‘#’ which represents a backspace, you need to print true if both the strings will be equal after processing the backspaces.
Example:
AA##BCAS#
B#BCA
Output:
True
(Expected time complexity: O(n))
(Expected space complexity: O(1))
Round 3:
Q1. Tell me about yourself?
Q2. Implement a stack that can do operations like push, pop, find the mid element and delete the mid element in O(1).
Q3. Given a binary tree and a key, print all the elements in the path from the key to the root.
Round 4:
Q1. Tell me about yourself?
Q2. Given a directory tree, you need to find out kth largest file. (Expected time complexity n log k)
Q3. Given a staircase and you can take either 2 jumps and or 1 jump at a time you need to find out the number of ways you can reach to n-th stairs.
Follow up: there are some stairs which are broken and you cannot jump ahead from those broken stairs.
Round 5:
Q1. Tell me about yourself?
Q2. Given a graph and you are starting from point 0, 0. You will be given commands like:
forward 40
right 50
left 30
backward 70
You need to print your location after processing these commands.
(Behavioural questions)
Q3. Tell me a mistake you regret the most in your professional life?
Q4. Have you ever had a conflict with your manager?
Q5. What is your college CGPA?
Q6. What’s your current role in your team?


Round 6:
Q1. Tell me about yourself?
Q2. Why are you looking for a change?
Q3. The interviewer asked me to tell me some other approach for the questions asked in the 2nd round.
Q4. Tell me about the project you are working on in your current company.
Q5. Tell me about the challenges you faced in your projects.
From Round 2-5 I was told to write the code in pen and paper and they expecting a production-level code that means no compilation issue and no syntax errors and all the errors and edge cases handled.

-------------------------------------------------------------------------------------------------------------

1)You are given a string with httpweru.com.You have to insert / after http and before ru in the given string.It was a very easy question.
2)You are asked to find the number of depermutations in the array.


---------------------------------------------------------------------------------------------------

Round 1:  (1 hour)
Que 1:  You are given a list of packages and their dependencies as follows.
You need to return one of the order in which the packages should be compiled.
< 1, <2, 3, 10> >, < 7, <>>, < 2, <4, 5> >, < 3, < 5, 6, 7> >, < 8, <>>, <4, < >>,
<5, <6> >, < 6, <> >, < 10, <> >
Output Example – 6, 4, 5, 7, 2, 3, 8, 10, 1 –> If we can compile, else return NULL.
Topics: Graph, Topological sort, Cycle in a graph


Que 2: There are N Ropes. You need to connect N ropes into single rope into minimum cost.
Cost of connecting 2 ropes is length of connecting 2 ropes.
For 4, 3, 2, 6 length ropes ? Output will be 29.
Example: One of the ways to connect the rope. But you have to tell them the minimum cost.
4+6 = 10 –> [10, 3, 2]
10 + 3 = 13 –> [13, 2]
13+2 = 15 –> [15]
Total Cost = 10 + 13 + 15 = 38.
Topics: Min-Heap, Greedy
Round 2:  (1 hour)
Que 1: Q: Print a Binary Tree level by level alternating the order each level. (ZIG- ZAG Tree Traversal).
Topics: Tree, Dequeue, Stacks
Que 2:  Find the rank-k (k-th maximum) in a continuous stream of numbers.
Topics: Heap
> k=1
> 10, 5, 7, 3 => 10
> 10, 5, 7, 3, 12 => 12
> 10, 5, 7, 3, 12, 11, 15, 9 => 15
> k=2
> 10, 5, 7, 3 => 7
> 10, 5, 7, 3, 12 => 10
> 10, 5, 7, 3, 12, 11, 15, 9 => 12


Round 3: (1 hour)
Print top view of a binary tree.
Topics: Tree, queue
Round 4: Managerial round (40 minutes)
No coding questions in this round. Questions in this round were related to projects and past experiences only.
Every round was followed by a 10 minute discussion related to what you are doing in the current company and past experiences. And no doubt interviewers were very friendly.

----------------------------------------------------------------------------------------------------------------------

Online Assessment
There were two coding questions:
1. One based on standard BFS in a matrix
2. Based on priority queue something similar to k Order statistics
Virtual Onsite Interviews:
Round 1: 


1.There are two types of chocolates Milk chocolate and Dark chocolate and N rows of such chocolates. You are given some number X(milk chocolate) and Y(dark chocolate) that is the number of chocolates you have to complete . You have to find what is the maximum number of rows you can cover? (Sorry, if the description is not clear but in the interview I was given this description only, I’ll try to clear it with help of some examples).
Note: Order of chocolates is not important.
Example 1: M M D D
D D
D M M
X=3 Y=4
Output: 2
As we can cover either row 1 and row 2 or row 2 and row 3 but not all the rows.
Example 2: D D
M
D M M
X=1 Y=1
Output: 1
As we can cover only row 2.
Example 3: M M D D
D D
D M M
X=5 Y=7
Output: 3
As we can cover all the rows.
2. https://www.geeksforgeeks.org/count-subarrays-equal-number-1s-0s/
Round 2:
1. https://www.geeksforgeeks.org/sliding-window-maximum-maximum-of-all-subarrays-of-size-k/
2. You are given a linked list and a number k. You have to sort the linked list in groups of size k by the sum value of each individual chunk in decreasing order. The elements within a chunk will not change.
Example:
Linked List: 1->3->0->5->1->7->0->2->4->3
k=2
Output: 1->7->4->3->0->5->1->3->0->2
Explanation:
1->3=4
0->5=5
1->7=8
0->2=2
4->3=7
So, the chunk 1->7 has sum 8 which is the highest so it will be placed first. Then chunk 4->3 with sum 7 after it and so on.
Round 3: With Senior Technical Program Manager
Behavioural LP
Role in current company sort of questions.
Little discussion about projects.
What is caching?
OOPS questions like inheritance, problems faced in inheritance, diamond problem and virtual keyword.
Design LRU cache ( only approach was discussed, no need to code).
Coding question: careercup.com/question?id=5717962873896960
Round 4: Senior Manager
Detailed discussion about projects and current role. Lots of behavioural questions based on LP.
What is caching? Types of caching algorithm.
Design LRU cache. Extended it a little bit how you will handle if more than one thread try to insert value in cache at the same time. Also, should know whatever STL containers you are using how they are implemented. I was asked how is list implemented in C++ (doubly linked list or singly linked list not too much depth).
More LP.

-----------------------------------------------------------------------------------------------------------

ound 1: Telephone Interview
  1. Initial, Questions were mostly from Technologies mentioned in the Resume.
  2. After that they entered into coding part and they shared a online editor which belongs to amazon .
    -> question 1: Given a Set of strings find the number of occurrences of each string .
    -> question 2: Given array of even and odd numbers move even numbers to front and odd number to end
    they excepted optimized solution for both questions.
  3. Few questions on scripting like they asked what are the linux commands you know and where you have used it .
  4. Database query question based on join and some stuffs.

Round 2:


After an hour of telephone interview got the call from hr saying short listed for further rounds of face to face interviews .
  1. Two people came for interview panel  . they started with resume and entered the main part  with simple coding . First question to print the pattern .
    *
    *   *
    *      *    *
    -> and second question  was some java output debugging with operator precedence . 2 debugging questions like this.
  2.  Another guy started his part with one coding questions given two arrays merge into a single array .
  3. Find number of occurrences of a word in a file  using any one of the scripting language ruby, shell or linux commands
  4. they asked me any questions i just asked about how an application engineer work will be there in amazon . they explained about it .
Round 3: After an half hour of waiting this round started with two people
1.  This round is full of scripting and scenario based debugging questions .  they started with scripting questions
how will you get count of number of errors occurred from a log file .
2.  How will you automate the before question scenario with multiple servers running  ?   have to answer with automation script how to do this
3. Explain about my current project and its architecture .
4. Given a search result it takes millisec to complete and it takes more than a sec on the second day of query . what might have happened and explain what would you do ?  . they tried to get answer from me itself without giving any clue .  Answer : due to duplicate contents index might have gone wrong and indexing needs to be improved or fixed .
5. They asked me few behavioral questions and asked me what is your greatest achievement in work so far.
Round 4 :  After my Lunch this round started
  1. this is more of problem solving
    one guy can and just started with a coding question . given an array of strings group the string that are anagram to each other . group non anagram strings separately . started with a brute force solution . he asked to optimize more in tc and sc .
    after giving the more optimized solution he asked me to code it .  The guy who came to me is more even worse he was seeing syntax errors also in code .
    2.  Second one was : Given an array and constant k , find the maximum number in the window size of k . same like started with a brute force and ended with optimized solution .
    3. After these questions he asked me few behavioral questions to analyze my decision making .
Round 5: Manager round 
1. he came with a horrer face . he didnt even see my face looking at his laptop  started his first question .  Given a Jar of Pills find the jar with defective pills puzzle questions .
2. After that he also asked me my current project explanation and architecture .
3. based on that he asked again a scripting question . group files of particular format and zip and move it to given folder location .
4. then asked me any questions .  i asked about application engineer work . he given a detailed explanation of work and asked me to have some coffee . hr will come and inform me like that .
HR came and once we get feedback from every panel will let you know the results . After one week they called me and offered me Application Engineer 2 position …

--------------------------------------------------------------------------------------
Round 1:
Q1) Given the column number in an Excel sheet, find the column name.


Q2) Given a binary tree find the maximum sum from one leaf node to another.
Q3) Modify Facebook’s friend request operation by adding a condition that a person can only send a friend request to someone if they have at least 1 mutual friend.
Here the interviewer asked to use an appropriate DS to store the friend list. I used the adjacency list representation and searched for common values in the two lists.
Round 2:
Q1) Given a binary tree, perform Zig-Zag level order traversal of the tree.
Q2) Given a tree T1 with millions of nodes and a tree T2 with hundreds of nodes check if T2 is a subtree of T1.
Q3) Difference between an interface and an abstract class.


I wrote a Java code to explain different scenarios where each of them can be used.
Q4) Reader Writer conflict in DBMS.
Round 3:
This round started with a project discussion. I explained my project and he asked some questions related to it.
Q1) You purchased a product from Amazon and now wish to return it. There are N pick up agents in your locality, you have to return the K closest ones.
I first solved it by sorting the distances and returning first K values. The interviewer asked me to optimize the solution. I solved it using a max heap.
Q2) Given a dictionary of strings and two strings s1 and s2, check if you can reach from s1 to s2 by selecting words from the dictionary. At each step, you are allowed to change only one letter of s1 at a time.
eg. dictionary = {cat, bat, pat, but, bun, sun, pun, put}
s1=cat, s2=sun
Answer: cat->bat->but->bun->sun


or cat->pat->put->pun->sun
I solved it by making an adjacency list for each string and then DFS to check the reachability of s2 from s1.
Round 4:
This round started with a discussion of all the questions asked in the previous round.
Q1) Find the diameter of a given n-ary tree and return the two end nodes of the diameter.
I first solved it for a binary tree then extended the solution for an n-ary tree.
Q2) What happens when you type www.amazon.com?
A long discussion on DNS, ARP, and TCP/IP stack was done.
Q3) What is a deadlock? What are the conditions for a deadlock to occur?
Q4) Http vs Https


The interviewers were really motivating and friendly. I had an amazing experience and enjoyed solving problems in all of these rounds. Just maintain a calm mind during your interview; it will help you solve the problems quickly.
Verdict: Selected!

-----------------------------------------------------------------------------------------------------
First Technical Round:
1. Given two arrays and we need to find whether one array is a subset of other or not


Ex:
array1: 1 6 5
array2: 1 4 7 3 5 6
o/p: yes
2. Given a matrix and there will be bombs in the cells, find the number of blasts. A group of connected bombs leads to blast.
3. Level order traversal of a tree.
Second Technical Round:
1. Find the lexicographically maximum level sum and its level of a tree.
Ex: 1 15 6 6 4 5 6 (i/p format: root left right )
Max Level sum : 21
Level: 1
2. Given a sorted array and an element x, find k closest elements to the x in an array
Ex; a : 12 15 18 21 22 43, k = 4, x = 20
o/p :15, 18, 21, 22
Third Technical Round:
1. Sort the given linked list.
2. Top view of a tree.
3. Operating System and Computer Network Basics like about DNS, Deadlocks, Routing, OSI model, Processors etc
Fourth Technical Round:
1. Given an array and split the array into two halves such that the absolute difference between them should be minimum.


Ex : 37, 43, 7, 54
o/p = (37+43) – (54+7) = 19
2. Given a string find the count of unique palindromic substrings
Ex: aabaaa
o/p: 6 ( a, b, aa, aba, aabaa, aaa)
3. LRU Cache
4. Infix to Postfix conversion
5. Inheritance and its types
6. Difference between linear and non-linear data structures.
Resume and the challenges faced in developing projects and asked about MENTORSHIP in Smart Interviews.
We need to give different approaches for a problem and need to write code for the optimized solution in your preferred language
Thank you so much Amit Bansal Sir and Abhishek Sir (SMART-INTERVIEWS) and GeeksforGeeks from the bottom of my heart. Because of your teaching and guidance, I am enjoying this fruitful result.
Verdict: Selected