Placement & HR

Amazon Interview Questions for SDE Roles

Amazon hires software development engineers (SDEs) in India through an online assessment followed by an interview loop of coding, design and behavioural rounds, all tested against its 16 Leadership Principles. These Amazon interview questions cover the coding problems Amazon asks most, design questions and Leadership Principles questions, with model answers and code.

21 questions · Updated

Reading answers is not the same as saying them.Practise Amazon questions out loud and get a score, what you missed and a model answer for each one.
Practise free with AI
Amazon interview process: 1. Online assessment (Coding problems and a work style survey), 2. Phone screen (A technical round for some roles), 3. Interview loop (Coding, design and Leadership Principles), 4. Bar raiser (A senior interviewer from another team), 5. Debrief (All interviewers decide together).
The Amazon interview process, step by step.

How to prepare for the Amazon interview

Coding round (DSA)

Data structures and algorithms problems solved live, usually in 45 minutes each. Explain your approach before you code.

1. Given an array of integers and a target, return the indices of two numbers that add up to the target.

Answer flow · 4 steps
  1. A brute-force check of every pair takes O(n²).

  2. Instead, walk through the array once and store each number's index in a hash map; for each number, check whether target minus that number is already in the map.

  3. This takes O(n) time and O(n) space.

  4. Mention edge cases such as duplicates and no valid pair.

def two_sum(nums, target):
    seen = {}                      # value -> index
    for i, x in enumerate(nums):
        if target - x in seen:
            return [seen[target - x], i]
        seen[x] = i
    return []

# two_sum([2, 7, 11, 15], 9) -> [0, 1]

2. Find the length of the longest substring without repeating characters.

Answer flow · 4 steps
  1. Use a sliding window with two pointers and a map of the last index of each character.

  2. Move the right pointer forward; if the character was seen inside the current window, move the left pointer just past its previous position.

  3. Track the maximum window size.

  4. This is O(n) time and O(k) space, where k is the size of the character set.

def longest_unique(s):
    last, left, best = {}, 0, 0
    for right, ch in enumerate(s):
        if ch in last and last[ch] >= left:
            left = last[ch] + 1
        last[ch] = right
        best = max(best, right - left + 1)
    return best

# longest_unique("abcabcbb") -> 3

3. Count the number of islands in a 2D grid of land and water.

Answer flow · 3 steps
  1. Scan the grid; each time you find unvisited land, increase the count and run a DFS or BFS from it to mark all connected land as visited.

  2. Each cell is visited once, so the time is O(rows × columns).

  3. Mention that recursion depth can be large for big grids, so an iterative BFS with a queue is safer.

def num_islands(grid):
    rows, cols, count = len(grid), len(grid[0]), 0
    def sink(r, c):
        if 0 <= r < rows and 0 <= c < cols and grid[r][c] == "1":
            grid[r][c] = "0"
            sink(r + 1, c); sink(r - 1, c); sink(r, c + 1); sink(r, c - 1)
    for r in range(rows):
        for c in range(cols):
            if grid[r][c] == "1":
                count += 1
                sink(r, c)
    return count

4. Design and implement an LRU (least recently used) cache.

Answer flow · 3 steps
  1. An LRU cache needs O(1) get and put.

  2. Use a hash map from key to node and a doubly linked list ordered by recent use: on get, move the node to the front; on put, insert at the front and, if over capacity, remove the node at the back and delete it from the map.

  3. In Python, OrderedDict provides this behaviour, but interviewers often ask you to build the linked list yourself.

from collections import OrderedDict

class LRUCache:
    def __init__(self, capacity):
        self.cap, self.data = capacity, OrderedDict()

    def get(self, key):
        if key not in self.data:
            return -1
        self.data.move_to_end(key)          # mark as recently used
        return self.data[key]

    def put(self, key, value):
        self.data[key] = value
        self.data.move_to_end(key)
        if len(self.data) > self.cap:
            self.data.popitem(last=False)   # evict least recently used

5. Return the k most frequent elements in an array.

Count frequencies with a hash map, then either keep a min-heap of size k (O(n log k)) or use bucket sort, where index i holds the numbers that appear i times, and read buckets from the highest (O(n)). Explain both and pick bucket sort for the best complexity.

from collections import Counter

def top_k_frequent(nums, k):
    buckets = [[] for _ in range(len(nums) + 1)]
    for num, freq in Counter(nums).items():
        buckets[freq].append(num)
    result = []
    for freq in range(len(buckets) - 1, 0, -1):
        result.extend(buckets[freq])
        if len(result) >= k:
            return result[:k]

6. Merge all overlapping intervals.

Answer flow · 4 steps
  1. Sort the intervals by start time.

  2. Walk through them, and if the current interval starts before the last merged one ends, extend the end; otherwise add it as a new interval.

  3. Sorting dominates, so it is O(n log n) time.

  4. This pattern also appears in scheduling and delivery-slot questions.

7. How many minutes until all oranges in a grid rot (rotting oranges)?

Answer flow · 5 steps
  1. This is a multi-source BFS.

  2. Put all rotten oranges in a queue at minute zero and count fresh oranges.

  3. Process the queue level by level; each level is one minute, and each rotten orange rots its fresh neighbours.

  4. When the queue is empty, return the minutes if no fresh oranges remain, otherwise -1.

  5. Time is O(rows × columns).

8. Find the kth largest element in an unsorted array.

Answer flow · 4 steps
  1. Keep a min-heap of size k: push each element, and pop when the heap grows beyond k. The top of the heap is the answer.

  2. This takes O(n log k).

  3. Quickselect gives O(n) on average but O(n²) in the worst case.

  4. Mention that for a stream of numbers, the heap approach works without storing everything.

System design and technical depth

Design questions and computer science fundamentals. Low-level design for freshers, high-level design for experienced engineers.

9. Design the classes for a parking lot (low-level design).

Answer flow · 4 steps
  1. Clarify requirements first: vehicle types, floors, spot sizes, ticketing and payment.

  2. Core classes: ParkingLot (has floors), Floor (has spots), ParkingSpot (size, is it free), Vehicle with subclasses, Ticket (vehicle, spot, entry time) and a PaymentService.

  3. A spot-assignment strategy picks the nearest free spot of the right size; keeping it as an interface lets you change the rule.

  4. Discuss concurrency when two cars try to take the same spot, solved with locking or atomic updates.

10. How would you design Amazon's order processing system?

Answer flow · 3 steps
  1. Split it into services: cart, order, inventory, payment and shipping.

  2. Placing an order creates an order record, reserves inventory and charges payment; because these span services, use a saga pattern with compensating actions, such as releasing inventory if payment fails, rather than one distributed transaction.

  3. Use a message queue between services so spikes such as sale days do not overwhelm them, idempotency keys so retries do not charge twice, and a database partitioned by customer or order ID.

11. Explain the CAP theorem with an example.

Answer flow · 4 steps
  1. In a distributed system facing a network partition, you must choose between consistency (every read sees the latest write) and availability (every request gets a response).

  2. A shopping cart can favour availability: it is better to let the customer add items during a partition and merge later.

  3. A payment ledger must favour consistency: rejecting a request is better than showing a wrong balance.

  4. When there is no partition, the trade-off is between latency and consistency.

12. How would you scale a database that is getting too slow?

Answer flow · 4 steps
  1. First find the bottleneck with metrics and slow query logs, and fix queries and indexes.

  2. Then add caching (such as Redis) for frequent reads and read replicas to spread read traffic.

  3. If writes or data size are the problem, partition (shard) the data by a key such as customer ID, choosing a key that spreads load evenly.

  4. Consider moving suitable data to a NoSQL store such as DynamoDB, which scales horizontally by design.

13. Design a notification service that sends email, SMS and push notifications.

Answer flow · 4 steps
  1. Other services publish notification requests to a queue.

  2. Workers read the queue, look up user preferences and templates, and send through provider-specific channels.

  3. Add retries with backoff, a dead-letter queue for failures, rate limiting per user so no one is spammed, deduplication with idempotency keys, and tracking of delivery status.

  4. Separate queues per channel stop a slow SMS provider from delaying emails.

Leadership Principles round

Questions about your past work and how you behave in a team. Answer with real stories using the STAR method.

14. Tell me about a time you went above and beyond for a customer. (Customer Obsession)

Answer flow · 4 steps
  1. Pick a story where you understood the real customer need, not just the request.

  2. For example: "During my internship, users complained the report download was slow.

  3. Instead of only speeding up the query, I spoke to two users and learned they only needed last month's data.

  4. I added a date filter as the default, which cut download time from 40 seconds to 3, and support tickets on it stopped." End with the measurable result.

15. Tell me about a time you took ownership of something outside your responsibility. (Ownership)

Answer flow · 4 steps
  1. Show that you acted like an owner, not a bystander.

  2. For example: "Our team's build kept failing because of a flaky test owned by another team.

  3. Rather than re-running it, I investigated, found a timing issue, fixed it with their approval and added a note to our on-boarding guide.

  4. Build failures dropped by 30%." Amazon wants people who do not say "that is not my job".

16. Tell me about a time you disagreed with your manager or team. (Have Backbone; Disagree and Commit)

Answer flow · 4 steps
  1. Show that you raised your concern respectfully with data, and then committed fully once a decision was made.

  2. For example: "I disagreed with releasing a feature without load testing.

  3. I showed my lead past incident data, and we agreed on a one-day test.

  4. It found a memory leak we fixed before launch." If the decision went against you, say how you still supported it fully.

17. Tell me about a time you had to make a decision with incomplete information. (Bias for Action)

Answer flow · 4 steps
  1. Amazon values calculated risk-taking when a decision is reversible.

  2. For example: "A production issue was affecting checkout at night, and the owner was unreachable.

  3. I had enough logs to see a recent configuration change was the likely cause, so I rolled it back, which is easily reversible, and documented everything.

  4. Errors dropped immediately, and the owner confirmed the cause the next morning."

18. Tell me about a time you dug deep into data to solve a problem. (Dive Deep)

Answer flow · 4 steps
  1. Show that you went beyond surface metrics.

  2. For example: "Our app's average response time looked fine, but some users complained.

  3. I looked at the 99th percentile latency and found it was ten times the average for users with large order histories.

  4. The cause was an unindexed query, and adding an index fixed it." Mention the tools and data you used.

19. Tell me about a time you missed a deadline or failed. (Deliver Results; Earn Trust)

Answer flow · 4 steps
  1. Be honest, own the failure and focus on what you learned and changed.

  2. For example: "I under-estimated an integration task and missed a sprint deadline.

  3. I told my lead two days before, not on the day, re-planned with a smaller first release, and delivered the rest the following week.

  4. Since then I break tasks into one-day pieces and flag risks early." Never blame others.

20. Tell me about a time you simplified a complex process. (Invent and Simplify)

Answer flow · 3 steps
  1. Describe a real simplification with a result.

  2. For example: "Our team released manually using a 20-step document, which took two hours and often went wrong.

  3. I wrote a script and a CI pipeline that reduced it to one command and ten minutes, and release errors stopped." Interviewers like solutions that remove work rather than add to it.

21. Tell me about something new you learned recently. (Learn and Be Curious)

Answer flow · 3 steps
  1. Show genuine curiosity and how you applied what you learned.

  2. For example: "I wanted to understand how databases handle concurrent writes, so I read about MVCC in PostgreSQL and built a small experiment.

  3. That helped me fix a lost-update bug in our project by using row-level locking." Mention how you keep learning regularly.

Ready to test yourself?Pick your topics and level, answer by voice or text, and get instant feedback. Free.
Start a mock interview

Related skill interview questions

HR round, company and bank interview questions

Bank and government exams

Interview questions by field

Company names are trademarks of their respective owners. Interview Ready is an independent practice site and is not affiliated with or endorsed by any company listed here.