Back to blogs
Amazon SWE Interview Questions: Real DSA and System Design Problems (2026)

Amazon SWE Interview Questions: Real DSA and System Design Problems (2026)

โœ๏ธ โ€‰ Piyush Chhabra|โ€ƒ ๐Ÿ—“๏ธ

If you are searching for Amazon SWE interview questions, you are probably past the generic advice stage. You want problems that have actually shown up in Amazon coding and design rounds โ€” not another "grind Leadership Principles and 200 LeetCode" post.

This guide covers real DSA and system design questions reported by Amazon candidates in 2026. Each coding problem includes the statement, a worked example, how to approach it, and the follow-up interviewers tend to ask.

These questions come from InterviewTruth's live Amazon feed. For the full, updated list, see Amazon interview questions on InterviewTruth.


What to expect in an Amazon SWE interview

Amazon software engineer interviews typically include:

  • Online assessment โ€” 1โ€“2 timed coding problems, plus a work-style survey
  • 1โ€“2 coding rounds โ€” LeetCode medium, sometimes with a data-structure design follow-up
  • 1 system design / LLD round (SDE 2+) โ€” Amazon-flavored products: orders, subscriptions, inventory, delivery
  • Leadership Principles โ€” in every round, not just the hiring manager or Bar Raiser

The problems below are not guaranteed repeats, but they reflect patterns Amazon actually tests: trees, range/array processing, custom data structures, and order-workflow design.


Amazon DSA interview questions

Problem 1: Sum of efficiencies based on subarray concatenations

Source: Candidate report (X)

Problem statement

You are given an integer array arr and a list of pairs. Each pair [L, R] is a subarray of arr (inclusive indices). Build a new array efficient by concatenating those subarrays in the given order.

For every index i in arr:

  • If index i appears in any chosen subarray, its efficiency is 0
  • Otherwise, its efficiency is the number of values in efficient that are strictly smaller than arr[i]

Return the sum of efficiencies of all elements.

Example

arr   = [10, 3, 7, 1, 8]
pairs = [[1, 2], [3, 3]]

efficient = [3, 7] + [1] = [3, 7, 1]
  • Index 0 (10) is not covered โ†’ 3 values in efficient are < 10 โ†’ 3
  • Indices 1, 2, 3 are covered โ†’ 0
  • Index 4 (8) is not covered โ†’ 3 and 1 are < 8 โ†’ 2
Output: 5

How to approach it

Don't build efficient and scan it for every index. That is too slow if ranges are long.

  1. Mark covered indices with a difference array (or a boolean array if n is small).
  2. Collect the values that land in efficient. If ranges can overlap, the same index may appear more than once โ€” keep the duplicates. That is what concatenation means.
  3. Sort those values.
  4. For each uncovered arr[i], binary search how many values in the sorted list are < arr[i].

Complexity: O(n + m log m), where m is the total length of the concatenated ranges.

Follow-up (common at Amazon)

What if the same index appears in many overlapping ranges? And what if you only need the set of values, not the concatenated multiset?

Clarify first. If they want a set, dedupe before sorting. If they want concatenation, count with multiplicity. Interviewers are checking whether you notice the difference.

Pattern: Range marking ยท sorting ยท binary search


Problem 2: Distance between two nodes in a binary tree

Source: Amazon SDE 2 interview experience (LeetCode Discuss)

Problem statement

Given the root of a binary tree and two nodes source and target, find the distance (number of edges) between them. You are not given parent pointers โ€” only the root and the two nodes.

Example

        1
       / \
      2   3
     / \
    4   5

source = 4, target = 3
Output: 3

Path: 4 โ†’ 2 โ†’ 1 โ†’ 3 (3 edges).

How to approach it

This is an LCA problem in disguise.

  1. Find the lowest common ancestor of source and target.
  2. Distance = depth(source) + depth(target) - 2 * depth(LCA).

You can also walk from the root to each node, store the paths, and count from the last shared node. Same idea, a bit more extra space.

If the nodes are given as values (not references), do one DFS to locate both while you compute depths.

Complexity: O(n) time, O(h) space.

Follow-up (common at Amazon)

Now print the step-by-step directions from source to target (U, L, R), not just the distance.

Find the LCA, walk source โ†’ LCA as Us, then LCA โ†’ target as L/R. This is LeetCode 2096.

Pattern: Trees ยท LCA ยท DFS path reconstruction


Problem 3: Stack with O(1) push, pop, top, and getMiddle

Source: Amazon SDE 2 interview experience (LeetCode Discuss) ยท similar problem

Problem statement

Design a stack that supports all of these in O(1) time:

  • push(x)
  • pop()
  • getTop()
  • getMiddle()

Example

push(1), push(2), push(3), push(4), push(5)
getTop()    โ†’ 5
getMiddle() โ†’ 3
pop()
getMiddle() โ†’ 2

How to approach it

A plain array gives you top in O(1), but middle takes O(n) if you scan โ€” or O(1) lookup if you store size, but then pop from the "middle pointer" still needs a list you can move on.

The clean design is a doubly linked list + a pointer to the middle:

  • push: append at the tail, increment size. If size becomes odd, move mid one step toward the tail.
  • pop: remove the tail, decrement size. If size becomes even, move mid one step toward the head.
  • getTop: return the tail.
  • getMiddle: return mid.

You can also use two deques (left half and right half) and rebalance so their sizes differ by at most one. Same complexity, a bit easier in languages with a deque.

Follow-up (common at Amazon)

Add deleteMiddle() in O(1), then getKthFromMiddle(k).

deleteMiddle is natural with a DLL. For k-th from middle, a DLL walks k steps โ€” say so out loud, then ask if they want that faster (it needs extra indexing).

Pattern: Data-structure design ยท doubly linked list ยท two deques


Amazon system design interview questions

Amazon design rounds like real order-flow problems: subscriptions, carts, inventory, delivery. Breadth first, then one deep cut. Prepare a 35โ€“45 minute outline for each prompt below.

1. Design a subscription service for automated recurring orders

Source: Amazon SDE 2, Bangalore (LeetCode Discuss) ยท related prompt

The prompt

Users subscribe to recurring orders โ€” for example, 2 packets of milk every Monday. The system should create those orders automatically, on schedule, at scale.

This is Subscribe & Save / "buy again" thinking. Interviewers want a scheduler + order pipeline, not a CRUD app.

What interviewers probe

  • Subscription model: item, quantity, cadence, next-run time, timezone, pause / skip / cancel
  • Scheduler: cron on next_run_at, or a delay queue (one message per due subscription)
  • Order creation: idempotent so a retry does not double-charge
  • Downstream: inventory reservation, payment, address, notifications
  • Failure: payment fails, item is out of stock, user paused after the job was already queued

A simple shape that works

  1. Subscription Service stores the plan and computes next_run_at.
  2. A worker pulls due subscriptions (or consumes a delay-queue message).
  3. It calls Order Service with an idempotency key like subscriptionId + scheduledDate.
  4. Order Service talks to Payment and Inventory.
  5. On success, advance next_run_at. On retryable failure, retry with backoff. On hard failure, mark the run failed and alert the user.

Key trade-offs

  • Cron scan vs delay queue: a scan is simpler; a queue scales better when millions of subscriptions cluster on Monday 6am.
  • Create the order at schedule time vs pre-generate the next N orders: pre-generate makes skip/pause messy; just-in-time is easier to reason about.
  • Strong vs eventual consistency between subscription state and the order that just got placed.

2. Low-level design for the same subscription system

Source: Amazon SDE 2, Bangalore (LeetCode Discuss)

Amazon often follows the HLD with LLD on the same problem. They want entities, state, and how you would actually code it.

What interviewers probe

  • Entities: User, Subscription, LineItem, Schedule, Order, PaymentMethod
  • Subscription states: ACTIVE, PAUSED, CANCELLED, PAYMENT_HOLD
  • How recurrence is stored: cron expression vs frequency + nextRunAt
  • Who owns "create order" โ€” a SubscriptionScheduler vs the Subscription object itself
  • How you avoid placing two orders for the same Monday (unique constraint / idempotency key)

A tight class sketch

Subscription
  id, userId, status
  items: List<LineItem>
  schedule: Schedule          // cadence + timezone + nextRunAt
  paymentMethodId
  placeOrder()                // or better: a service method
  pause() / resume() / cancel()
  advanceSchedule()

Schedule
  frequency                    // WEEKLY, MONTHLY
  dayOfWeek / dayOfMonth
  timezone
  nextRunAt()

Keep the domain objects small. Put "find due subscriptions and enqueue work" in a service, not inside Subscription.

Key trade-offs: anemic models (all logic in services) vs fat domain objects; cron strings vs explicit nextRunAt you can index.

For more on how LLD rounds go wrong, see how to crack LLD interviews.


How to use this list effectively

  1. Solve each DSA problem in 35โ€“40 minutes under timed conditions โ€” that is roughly an Amazon coding round after LP warm-up.
  2. Practice the follow-up. Amazon interviewers often turn a coding problem into a small design problem (see the stack).
  3. For design, talk about orders and failure. Idempotency, stock, and payment retries score more than drawing extra boxes.
  4. Prepare LP stories for the same hour. A perfect solution with a vague "we shipped it" story is still a weak Amazon round.
  5. Cross-check with live reports. Questions rotate. Use InterviewTruth's Amazon interview questions page to see what candidates are posting this week.

Frequently asked questions

What DSA topics does Amazon ask most?

Recent Amazon SWE interview questions cluster around trees, arrays with ranges or prefixes, heaps, and design-a-data-structure problems. Pure hard DP shows up less than at Google. Custom stacks, caches, and schedulers show up more.

How hard are Amazon coding interview questions?

Most Amazon coding rounds are LeetCode medium. The bar is clean code, edge cases, and explaining trade-offs โ€” not a brutal unseen hard problem. SDE 2+ may add an LLD twist on the same problem.

Does Amazon repeat interview questions?

Yes, more often than Google. Variations of tree distance, stack/queue design, and order/subscription design show up across years. That is why tracking recently asked Amazon questions is more useful than random grinding.

Does every Amazon round include Leadership Principles?

Yes. Even coding rounds usually start or end with 5โ€“10 minutes of LP questions. The Bar Raiser and hiring manager go deeper. Prepare stories; do not treat LPs as a separate "HR" round.

How many system design rounds does Amazon have?

SDE 1 often has 0โ€“1 design rounds (sometimes LLD). SDE 2 and above usually have 1 dedicated design round, and it is common for that round to include both HLD and LLD on the same prompt.

What is the best way to prepare for Amazon SWE interview questions?

Focus on signal over volume: solve recent Amazon-tagged problems, practice 4โ€“5 order-flow design outlines (cart, subscription, inventory, delivery), and build a small bank of LP stories with real numbers. Then browse live Amazon interview reports the week of your loop.


Final thoughts

Amazon SWE interview questions are less about exotic algorithms and more about clear patterns plus production judgment. The coding problems above have a clean optimal solution once you see the pattern. The design prompts reward candidates who think in schedules, idempotency, and failure โ€” the same things Amazon's order systems worry about every day.

Start with the problems on this page. Then stay current with live Amazon interview reports. Good luck.

Recent Interview Questions by Software Companies

Real interview questions from top tech companies, updated every day. Yes, every day. We look for new questions shared by candidates across the internet and add them to the site so you can prepare smarter.