Amazon Interview Experience (AmazonWow)
Online Test: There were 28 MCQs mostly based on stacks, queues, predict the output, Sorting, and Binary Trees and 2 coding questions.
1) Given a string convert it into a valid address by inserting a ‘.’ after www then insert a ‘.’ before com and if there are more characters after com then put a ‘/’ after com and then the rest of the characters.
Eg:
Input: wwwgooglecomr Output: www.google.com/r
Print the length of the longest decreasing subsequence.
Round 1 (Interview 1): The interviewer introduced himself and asked me to introduce myself.
Coding Questions
- Print all the pairs whose sum is equal to 0.
- He extended the question to find all the triplets with sum 0.
Round 2 (Interview 2): Coding Question
- Given n strings in ‘a/b=0.5′,’b/c=0.9’ format. Find the answer of q queries in ‘a/c’ format.
Hint: (Make a directed graph with a, b and other alphabets as vertices)
Round 3 (Interview 3):
- Tree-Based: Given a binary tree and one node is set on fire so find the time required to burn all the nodes.
- Stack Based: Given a string with ‘U’ and ‘D’. Find the number of mountains and valleys
Eg:
Input: UUDDDDUDUU Output: Mountain 1 is formed by UUDD and 1 Valley by DDUDUU
The interviewer expected me to code all the questions completely and helped in between if stuck to find the optimized approach.
Tips:
- Start coding after the interviewer is satisfied with your approach.
- First, clarify all the doubts and then give your solution.
- Dry run your code for multiple edge cases
- Try to write a clean code.
Please Login to comment...