Amazon Interview experience (Off-Campus 2019)
Hi all, Amazon conducted a pool drive in January 2019 in Gurugram. We were shared a link for the test hosted on HackerEarth. The pattern of the test was 20 MCQ’s and 2 Programming Questions.
Online Test:
20 MCQ’s based on OS, Network, COA, DBMS, OOPS.
Q1: Given a NxM Grid. The grid consists of only 3 integers(0, 1, 2)
- 0 denotes empty cell.
- 1 denotes a cell containing plant.
- 2 represents a cell where you are standing currently.
You can move to adjacent cells (Up, Down, Left, Right). Find the length of the shortest path to reach one of the boundaries without stepping on a plant.
Length of the path is the number of moves you make.
Q2: You are given some rules (<=26) an integer K.You can make several permutations of the rules while keeping the given rules fixed.
Write a program to find the Kth lexicographically smallest permutations of the rules.
Eg.
Input:
bcd (Rule)
xyz (Rule)
1 (K)
Output:
axyzbcdefghijklmnopqrstuvwxyz
Explanation:
Alphabets b, c, d have already been mapped to be represented x, y, z respectively. Now we need to find the lexicographically smallest (K=1) permutation of the alphabet. This is done if we assign each remaining alphabet to the earliest possible position in the permutation. Hence, the answer is axyzbcdefghijklmnopqrstuvwxyz.
I got the first question complete and the second question partial which was enough to qualify for the face to face interview.
Round 1:
I answered them both.
The interviewer first asked me to think of the approach and explain that approach to him.Once he was satisfied with the approach, He asked me to write production level code.
Round 2:
Q1: Given a list of IP addresses [192.12.23.45, 234.23.56.89, … ]. Remove duplicate IP’s in the list.
Sol: I gave the first answer that store the IP addresses in a set while iterating and if IP is found in set, remove it.
However, Interviewer wasn’t satisfied with the space complexity so he told me to reduce the space complexity.
I came up with a tries based solution where instead of storing an IP in set, I store it in Trie.(Space complexity is reduced as Node in Trie doesn’t take up space unless allotted a value as well as instead of creating a new node for every IP, in Trie a node can be reused if even half of the IP is same).
Q2: Maximum path sum
(Without Space Complexity)
Solved the first question completely but took more time, so couldn’t solve the second question on time.
Verdict: Rejected
Recommended Posts:
- Amazon Interview Experience | SDE-1 offcampus
- Amazon SDE Interview Experience (3 Aug 2019)
- Amazon Interview Experience SDE (On Campus 2019)
- Amazon SDE Interview Experience | On Campus 2019
- Amazon Interview Experience (On-Campus for SDE-1) 2019
- Amazon SDE Interview experience (July20, 2019)
- Amazon Interview Experience (Pool campus-2019)
- Amazon Interview Experience March 2019 (Off-Campus -Cloud Associate 1)
- Amazon Interview Experience (Pool campus- March 2019) - Pune
- Interview Experience at Naggaro 2019 (3 yrs of Experience)
- OYO Interview Experience 2019
- TCS digital 2019 Interview Experience
- TCS Codevita 2019 Interview Experience
- TCS Ninja Interview Experience 2019
- GS Lab Interview Experience August 2019
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.



