Amazon
30+ Interview Questions and Answers
Q1. find a missing number in unsorted array which is having elements in the range[1,n]
Find a missing number in an unsorted array with elements in the range [1,n].
Use a hash set to store the elements and check for missing numbers.
Calculate the sum of all elements and subtract it from the sum of the range [1,n].
Use XOR operation to find the missing number.
Q2. How many users did your system have?
The system had over 1 million users worldwide.
The system had a global user base.
The user count exceeded 1 million.
Users were from various countries and regions.
Q3. Can you describe how a hashmap works?
A hashmap is a data structure that stores key-value pairs and allows for constant time lookup and insertion.
Hashmaps use a hash function to map keys to indices in an array.
Collisions can occur when multiple keys hash to the same index, which can be resolved using techniques like chaining or open addressing.
Example: HashMap
map = new HashMap<>(); map.put("key", 123); int value = map.get("key");
Q4. Implement a simplified Video Codex using data structures
Implement a simplified Video Codex using data structures
Use a hash table to store key-value pairs of video frames and their corresponding codecs
Implement a priority queue to efficiently retrieve the most frequently accessed video frames
Consider using a linked list to maintain the order of video frames in the codex
Q5. What's the longest valid bracket sequence in a string?
Q6. Design SkipTracker() for amazon prime music.
Design SkipTracker() for Amazon Prime Music
SkipTracker() should keep track of skipped songs in Amazon Prime Music
It should maintain a list of skipped songs as an array of strings
The list should be updated whenever a song is skipped
SkipTracker() should provide methods to add, remove, and retrieve skipped songs
Q7. Design chat room where users can chat with each other and also able to join chat room
Design a chat room system where users can chat with each other and join chat rooms.
Implement user authentication and authorization to ensure secure access to chat rooms.
Create a database to store chat messages, user information, and chat room details.
Develop a real-time messaging system using websockets for instant communication.
Allow users to create new chat rooms and join existing ones.
Include features like message history, notifications, and user profiles.
Q8. Four back-to-back 1 hour sessions with 1 hour lunch break. system design with the manager, LC medium-hard questions with the rest of the interviewers.
The interview consists of four back-to-back 1 hour sessions with 1 hour lunch break, including system design with the manager and LC medium-hard questions with the rest of the interviewers.
Prepare for system design questions with the manager by understanding scalability, reliability, and performance considerations.
Practice solving LC medium-hard questions to showcase problem-solving skills and algorithmic knowledge.
Take advantage of the lunch break to relax and recharge for t...read more
Q9. Low level design for a product including designing classes and database
Designing classes and database for a product
Identify the entities and relationships in the system
Create a class diagram with attributes and methods
Design the database schema with tables and relationships
Consider performance, scalability, and security
Use appropriate design patterns and principles
Q10. Design a high level system design for inter-college discussion.
Q11. Design Unix Find File Library
Design a Unix Find File Library
Implement functions to search for files based on criteria like name, size, permissions, etc.
Utilize system calls like opendir(), readdir(), and stat() to traverse directories and gather file information.
Support options for recursive searching, filtering by file type, and specifying search depth.
Include error handling for cases like permission denied or invalid paths.
Provide a user-friendly interface with options for displaying results in differe...read more
Q12. System design for a delivery management system
Design a system to manage deliveries efficiently
Use a centralized database to store information about deliveries, drivers, and customers
Implement a tracking system to monitor the status of deliveries in real-time
Include features like route optimization, delivery scheduling, and notifications for customers
Consider scalability and reliability to handle a large volume of deliveries
Integrate with mapping APIs for accurate location tracking
Q13. Design multiplayer game like pubg
Design a multiplayer game similar to PUBG.
Create a large map with various terrains and buildings
Allow players to form teams and communicate with each other
Include a variety of weapons and equipment for players to find and use
Implement a shrinking play area to force players into closer combat
Include a ranking system to encourage competition and skill improvement
Q14. High level design for 3 products
High level design for 3 products
Identify user needs and requirements
Create a conceptual design for each product
Define the architecture and components
Consider scalability, security, and performance
Document the design and review with stakeholders
Q15. Design Alerting Monitoring System
Design a system to monitor and alert on system performance and health metrics.
Define key metrics to monitor such as CPU usage, memory usage, disk space, network traffic
Implement monitoring agents to collect data from servers and applications
Set up alerting rules based on thresholds for each metric
Integrate with notification systems like email, SMS, or Slack for alerts
Provide a dashboard for visualization of real-time and historical data
Q16. Max area in the histogram
Find the maximum area in a histogram.
Iterate through the histogram and calculate the area for each bar.
Keep track of the maximum area encountered so far.
The area of a bar is calculated by multiplying its height with the width (number of consecutive bars) it can extend to.
Consider using a stack to efficiently calculate the area for each bar.
Q17. Simplify path problem
The Simplify path problem involves simplifying a given absolute path to its canonical form.
Use a stack to keep track of the directories in the path.
Split the path by '/' and process each directory.
Ignore empty directories and '.'.
If encountering '..', pop the top directory from the stack.
Join the remaining directories in the stack to form the simplified path.
Q18. N-ary tree DFS problem
The question is about solving a problem related to N-ary tree using Depth First Search (DFS).
Understand the concept of N-ary tree and Depth First Search (DFS)
Implement the DFS algorithm to traverse the N-ary tree
Handle the tree nodes and perform necessary operations during traversal
Q20. Experiences of system design?
Experiences in system design include designing scalable and efficient software architectures.
Experience in designing software architectures to meet scalability and performance requirements
Understanding of system components and their interactions
Ability to optimize system design for efficiency and maintainability
Experience with tools and techniques for system design such as UML diagrams and design patterns
Q21. Russian doll envelop variant
Russian doll envelop variant is a problem where you need to find the maximum number of envelopes you can put inside each other.
Sort the envelopes based on width and height
Use dynamic programming to find the longest increasing subsequence based on height or width
The maximum number of envelopes that can fit inside each other is the length of the longest increasing subsequence
Q22. Tree traversal problem
Tree traversal problem involves visiting each node in a tree data structure in a specific order.
There are three main types of tree traversal: in-order, pre-order, and post-order.
In-order traversal visits the left subtree, then the root, then the right subtree.
Pre-order traversal visits the root, then the left subtree, then the right subtree.
Post-order traversal visits the left subtree, then the right subtree, then the root.
Q23. longest common subsequence
Longest common subsequence is the longest sequence of characters that appear in the same order in two or more strings.
Use dynamic programming to solve this problem efficiently.
Create a 2D array to store the lengths of longest common subsequences of substrings.
Traverse the array to find the longest common subsequence.
Q24. Design a movie booking system
Design a movie booking system for users to book tickets for movies at various theaters.
Users can search for movies by title, genre, or theater location.
Users can select seats and showtimes for the movie they want to watch.
System should handle payment processing and seat reservations.
Admins can manage movie listings, theater information, and user bookings.
Q25. Designing car cleaning service
Design a car cleaning service with various packages and add-on services for customers to choose from.
Offer different packages such as basic wash, interior cleaning, waxing, etc.
Provide add-on services like carpet shampooing, leather conditioning, headlight restoration, etc.
Allow customers to customize their service by selecting specific options they need.
Implement a loyalty program to reward repeat customers with discounts or free services.
Consider offering mobile car cleanin...read more
Q26. Product of array except self
Calculate product of all elements in array except the element itself
Iterate through array to calculate product of all elements except current element
Use two arrays to store products of elements to the left and right of current element
Multiply corresponding elements from left and right arrays to get final product
Q27. Word Ladder from leetcode
Word Ladder is a popular problem on LeetCode where you have to find the shortest transformation sequence from start to end word.
Use BFS to explore all possible transformations from the start word to the end word.
Build a graph where each word is a node and there is an edge between two words if they differ by one character.
Keep track of visited words to avoid revisiting them and use a queue for BFS traversal.
Return the length of the transformation sequence or 0 if no transforma...read more
Q28. Gas station problem
Gas station problem
The gas station problem involves finding the minimum starting point from where a circular route can be completed without running out of gas.
The solution can be obtained using the concept of cumulative sum and tracking the minimum sum encountered.
If the total sum of gas is greater than or equal to the total sum of cost, a solution exists.
If there are multiple valid starting points, return the one with the lowest index.
Q29. Design amazon Prime
Design Amazon Prime - a subscription service offering fast shipping, streaming of movies, TV shows, music, and more.
Offer fast shipping for products purchased on Amazon
Provide access to a library of movies, TV shows, and music for streaming
Include exclusive deals and discounts for Prime members
Offer additional services like Prime Video, Prime Music, Prime Reading, and more
Q30. Coin change problem
The coin change problem involves finding the minimum number of coins needed to make a certain amount of change.
Start by creating an array to store the minimum number of coins needed for each amount from 0 to the target amount.
Iterate through each coin denomination and update the minimum number of coins needed for each amount.
Return the minimum number of coins needed for the target amount.
Q31. container problem
The container problem involves efficiently packing items into containers to minimize wasted space.
Use algorithms like First Fit, Best Fit, or Next Fit to optimize packing efficiency.
Consider the size and shape of items being packed to determine the best container arrangement.
Utilize dynamic programming or greedy algorithms to solve the container packing problem efficiently.
More about working at Amazon
Top HR Questions asked in null
Interview Process at null
Top Software Development Engineer II Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month