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.
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.
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.
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.
Q1: Given a list of IP addresses [184.108.40.206, 220.127.116.11, … ]. 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.
- Amazon Interview Experience Offcampus for SDE-1
- Amazon Interview Experience | SDE-1 offcampus
- Amazon Interview Experience 2019 (SDE, DE, SE )
- Amazon SDE Interview Experience (3 Aug 2019)
- Amazon FT Interview Experience 2019 (On-Campus)
- Amazon Interview Experience SDE (On Campus 2019)
- Amazon SDE Interview Experience | On Campus 2019
- Amazon Interview Experience for SDE | On-Campus 2019
- Amazon Interview Experience for SDE 1 | OFF-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 for SDE Intern | On-Campus November 2019
- Amazon Interview Experience March 2019 (Off-Campus -Cloud Associate 1)
- Amazon Interview Experience (Pool campus- March 2019) - Pune
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.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.