Amazon Interview Questions
The questions Amazon actually asks — distilled from 403 real candidate reports and ranked by how often they came up. Coding, system design, and behavioral, with model answers written by our team.
264
questions tracked
162
coding problems
403
reports analyzed
Most-asked Amazon questions
The questions reported most often across real Amazon interviews, each with a model answer written by our team.
Introduce yourself and discuss your background.
I'm a full-stack engineer with 5+ years building scalable systems. Early career, I shipped payment infrastructure at a fintech startup, learning how ownership and bias-for-action drive results. Recently, I've focused on high-standards code review and mentoring—helping teams simplify complexity and catch issues early. I'm drawn to Amazon because I admire customer obsession and your bar-raising culture. I'm excited to tackle large-scale problems where attention to detail and invention directly impact customers.
Discuss your experience with Amazon's leadership principles
At my previous company, I owned improving a critical, under-resourced system (Ownership). When stakeholders blamed external constraints, I prototyped a simpler architecture (Invent and Simplify), validated it with real data (Dive Deep), and delivered an 18% efficiency gain with zero downtime (Deliver Results). The team was skeptical initially, but I earned their trust through transparency and rigor. This experience showed me that Amazon's principles—especially Ownership, Bias for Action, and Frugality—differentiate great teams. I've modeled my approach around them ever since.
Implement an LRU (Least Recently Used) cache.
Combine a HashMap with a doubly-linked list. HashMap maps keys to list nodes (O(1) access); the list tracks order: least-recent at head, most-recent at tail. On get(), move the node to the tail. On put(), insert at the tail; if capacity overflows, remove the head. Doubly-linked structure enables O(1) node removal and reinsertion—the critical insight that avoids scanning.
Respond to leadership principles questions and introduce yourself.
When introducing yourself and responding to leadership principle questions, lead with impact: briefly share your role, 1-2 key achievements, and what drives you professionally. Use STAR structure for examples—anchor each story to a specific Amazon principle (Customer Obsession, Ownership, etc.). Amazon values learning and growth over perfection, so discuss challenges you've faced and how you adapted. Quantify results when possible. Show genuine curiosity: ask how the principle relates to the team's current priorities, demonstrating you're thinking about contribution beyond the interview.
Describe how you handled a situation where you knew you would miss a deadline.
I owned a critical feature with a firm deadline. Halfway through, unexpected technical complexity emerged. Rather than hide the issue, I immediately escalated to my manager and stakeholders with data on the gap. I proposed three options: reduce scope, extend the deadline, or add resources. We chose to prioritize core functionality for on-time delivery, shipping the MVP as planned, with remaining features following two weeks later. This transparency prevented surprises and let stakeholders adjust their plans. Afterward, I improved our estimation process with better technical spikes upfront.
Solve the rotting oranges problem.
Use multi-source BFS, adding all initially rotten oranges to a queue simultaneously. Process level-by-level, infecting adjacent fresh oranges and tracking elapsed time. The key insight: simultaneous spreading requires BFS to model all rotten oranges expanding in parallel, not sequential DFS. After the queue empties, verify all oranges are rotten; return the maximum time encountered, or -1 if any remain fresh.
Count connected components in a binary matrix and return the size of each component.
Treat the matrix as an implicit graph where 1s are nodes and adjacent cells form edges (orthogonal connectivity). For each unvisited 1, perform DFS/BFS to explore all connected 1s, counting the component size. Mark cells as visited to ensure each is processed once. Collect component sizes in a result array. DFS is typically preferred for its simplicity and intuitive recursion. The approach ensures efficiency by visiting each cell exactly once, making it optimal for this problem.
Find the maximum amount that can be stolen from houses given adjacency constraints
Use dynamic programming tracking the max value obtainable up to each house. For each house, you either rob it (gaining its value plus the best from two houses back) or skip it (keeping the best from the previous house). Since the decision only depends on the prior two states, solve bottom-up with O(1) extra space: maintain only prev2 and prev1 totals, sliding forward. At each position, current = max(house[i] + prev2, prev1). Return the final max.
Given an array, find two numbers that sum to a target value.
Use a hash map to achieve single-pass efficiency. As you iterate through the array, for each number check if (target - number) exists in the map. If found, return the pair; otherwise, add the current number to the map. This transforms the problem from checking all pairs (O(n²)) into O(1) lookups. The insight: use a hash to trade space for time, avoiding sorting and nested iterations.
Group words by their anagram equivalence
Sort each word's characters to create a canonical form—anagrams map to identical sorted strings. Use a hash map keyed by this sorted form, grouping words with matching keys together. Iterate once through the input word list, accumulating words into their respective buckets, then return the grouped lists. This approach works because anagram equivalence is fully defined by character counts and frequencies.
Given an array, find the largest element in every sliding window of size k.
Use a deque to maintain indices of potential maximums in decreasing order of values. For each element: (1) remove indices outside the current window from the front, (2) remove indices with smaller values from the back, (3) add the current index. The front always holds the current window's maximum. This avoids rescanning the window each iteration. Key insight: smaller elements become irrelevant once a larger element enters the window, so we discard them immediately rather than storing all k elements.
Design a system for an Amazon-specific use case.
Design a distributed e-commerce platform handling millions of concurrent requests. Use API Gateway with load balancing for traffic routing. Partition microservices: Product Catalog (Elasticsearch), Orders (DynamoDB sharded by order ID), Inventory (Redis cache + DynamoDB), Payments (PCI-isolated). Deploy message queues (SQS/SNS) for async order processing and inventory updates. Use CloudFront for product data caching. Implement multi-region replication for availability, circuit breakers and rate limiting for resilience.
Determine the minimum number of meeting rooms required to accommodate all scheduled meetings.
The key insight is that the minimum rooms needed equals the maximum number of overlapping meetings at any time. Sort all meeting start times and end times separately. Use two pointers to sweep through events chronologically: increment a counter when processing a start time, decrement for an end time. Track the maximum counter value—this is your answer. This greedy approach works because it finds peak concurrency without checking all possible room assignments.
Merge multiple sorted arrays of integers into a single sorted array.
The key insight: use a min-heap to efficiently track the minimum element across k arrays. Maintain one element from each array plus metadata. Extract the minimum repeatedly, append to output, and insert the next element from that source array. This ensures every element—N total—undergoes exactly one log k heap operation. Time: O(N log k). Space: O(k) for the heap. A pairwise merge approach offers comparable performance with simpler implementation.
Find the k points closest to the origin from a given set of points.
Use a max-heap of size k. Iterate through all points, computing squared distances from origin (avoid sqrt). For each point: if heap size < k, add it; else if distance < heap's max, remove max and insert. This avoids sorting all n points, achieving O(n log k) instead of O(n log n). Key insight: maintain only k elements rather than sorting all points. The optimization is significant when k ≪ n.
Implement string manipulation code with emphasis on modularity and extensibility.
Use the Strategy pattern: each transformation (trim, reverse, uppercase) is a separate, stateless function following a common interface. Build a StringTransformer class that composes these operations, enabling method chaining: transformer.trim().removeWhitespace().uppercase(). Store operations in a list and execute sequentially. This approach: (1) decouples each transformation, (2) lets you add new operations as simple functions without modifying existing code, (3) enables independent unit testing, (4) supports runtime composition. Key insight: treat transformations as pluggable building blocks rather than tightly coupled methods.
Find three numbers in an array that sum to a target value
Sort the array. For each element, treat it as a pivot and use two pointers on remaining elements to find two numbers summing to target - pivot. Move pointers based on whether the sum is too small (move left pointer right) or too large (move right pointer left). This optimizes from O(n³) brute force to O(n²). Key insight: sorting unlocks the two-pointer technique. Skip consecutive duplicates to avoid duplicate triplets.