Online Assessment
Questions:
- Simple medium question based on sets.
- Medium question solvable only using Trie.
Time Taken: Solved both questions in 40 mins.
Sections:
- Section 2 & 3: Behavioral and situation-based questions.
Round 1: Technical (LLD)
Questions:
- Two Amazon Leadership Principles (LP) questions.
- Design Email Domain Server (LLD):
- Task: Design a system for domain name registration and email creation, including sending emails between users of the same and different domains.
Learnings:
- Don't just watch videos; practice solving problems independently.
- Use tools like draw.io for design practice.
- Discuss your thought process with the interviewer.
Candidate's Approach
- Followed STAR approach for LP questions but struggled to satisfy the interviewer.
- Initially misunderstood the design question; needed clarification.
- Partially solved the design problem with hints from the interviewer.
- Expected to provide a high-level design with database selections and component details.
Interviewer's Feedback
- The interviewer was supportive but emphasized the need for deeper understanding and preparation.
- Suggested that the candidate should practice more independently and discuss choices during the interview.
Round 2: Technical (DSA)
Questions:
- Given two nodes of a binary tree, find the distance between them.
- Tree structure:
TreeNode{ int val; TreeNode parent; }
- Example:
1 / \ 5 3 / \ \ 4 8 7
- Examples:
- distance(5, 7) output: 3
- distance(8, 7) output: 4
- distance(4, 8) output: 2
Time Taken: 35 mins for the tree question, followed by 20 mins for Amazon LP questions.
Candidate's Approach
- First Approach: Used a hashmap to store distances from node1 to root and checked for node2 in the map.
- Second Approach:
- Added nodes from node1 to root into a set.
- Iterated from node2 to find the lowest common ancestor (LCA) using the set.
- Calculated distances from both nodes to the LCA.
- Time & space complexity: O(h), where h is the height of the tree.
Interviewer's Feedback
- The interviewer seemed to have additional questions but time constraints limited the discussion.
- The candidate successfully explained edge cases after the main question.