Amazon China SDE 27NG Four-Round VO: GenAI Behavioral + Topological Sort + Minimum Size Subarray + Binary Search
Amazon China SDE 2027 new grad four-round VO recap: GenAI-themed behavioral questions (LPs and STAR tips), topological sort for product release order, minimum size subarray sum >= target, and a lower-bound binary search for inventory thresholds, with clarifying questions and follow-ups.
Schedule
| Round | Content |
|---|---|
| Round 1 | Pure behavioral (GenAI / LLM theme) |
| Round 2 | Coding: topological sort |
| Round 3 | Coding: minimum size subarray sum >= target (prefix sum + sliding window follow-up) |
| Round 4 | Coding: binary search |
Round 1: Behavioral
The interviewer was a Senior SDE focused on Customer Obsession, Invent and Simplify, Bias for Action, Learn and Be Curious. All questions were asked in English:
- Tell me about a time you leveraged generative AI / GAI tools to accelerate your coding or project work. What risks did you identify when using AI-generated code, and how did you mitigate them?
- Tests: you use AI but verify its output instead of copying blindly — ownership.
- Describe a situation where you needed to learn a new AI/tooling technology quickly for a project. How did you approach learning it?
- Tests: Learn and Be Curious
- Tell me about a time when an AI-assisted solution you tried did NOT work as expected. How did you troubleshoot and adjust your plan?
- Tell me about a time you proposed a simplification to a complex workflow using AI tools. What tradeoffs did you discuss with your team?
- Tests: Invent and Simplify
Tip: answer everything with STAR. Interviewers in the China region like concrete project details, not generalities. Mentioning AI hallucinations, code correctness and security risks earns extra points.
Round 2: Topological sort (Medium)
Problem (verbal)
We have a list of product dependencies for an e-commerce release. Each dependency
[A, B]means B must be released before A. Given the total number of productsnumProductsand a list of dependency pairs, return one valid release order of all products. If there exists a cycle in dependencies (circular dependency, impossible to release), return an empty array.
Example: numProducts = 4, dependencies = [[1,0], [2,0], [3,1], [3,2]], output [0,1,2,3].
Clarify
- Are product IDs unique integers?
- Can we have multiple valid answers? — We can return any valid topological order.
- What if there are zero dependencies? — Return any order of all products.
- What about duplicate edges in the input dependency list?
Solution: Kahn's algorithm (BFS)
- Build an adjacency list and an in-degree array.
- Run Kahn's algorithm with BFS.
- Repeatedly take a node with in-degree 0, append it to the result, and decrement its neighbors' in-degrees; a neighbor that reaches 0 joins the queue.
- If the result length differs from the number of products, there's a cycle — return an empty array.
from collections import deque
def release_order(num_products, dependencies):
graph = [[] for _ in range(num_products)]
indeg = [0] * num_products
for a, b in set(map(tuple, dependencies)): # drop duplicate edges
graph[b].append(a)
indeg[a] += 1
q = deque(i for i in range(num_products) if indeg[i] == 0)
order = []
while q:
u = q.popleft()
order.append(u)
for v in graph[u]:
indeg[v] -= 1
if indeg[v] == 0:
q.append(v)
return order if len(order) == num_products else []
Follow-ups
- What is the time & space complexity? — O(V + E), with V nodes and E edges.
- If we need to find all possible valid release orders, how to modify this solution? — DFS with backtracking.
- What if the graph is extremely large and cannot load all edges into memory? How to handle it?
Round 3: Minimum size subarray sum >= target
Problem (verbal)
Given an integer array
numsand a positive integertarget, find the minimal length of a contiguous subarray of which the sum is greater than or equal totarget. If there is no such subarray, return 0.
Clarify (ask proactively)
- Can the array contain negative integers?
- Does the subarray have to be contiguous? — Yes.
- What about an empty input array? — Return 0.
- What about a single element?
Approach
- Negatives allowed: prefix sums are no longer monotonic, binary search doesn't apply directly, and brute force is expensive.
- All positive: prefix sums increase monotonically, so binary search gets O(n log n).
- Follow-up 1: All elements positive, optimize to O(n log n).
- Follow-up 2: Can we solve it with a sliding window in O(1) space? — Yes. With positive numbers, two pointers give O(n) time and O(1) space.
- Edge case: return 0 if no valid subarray is found.
def min_subarray_len(target, nums):
best, left, s = float("inf"), 0, 0
for right, x in enumerate(nums):
s += x
while s >= target:
best = min(best, right - left + 1)
s -= nums[left]
left += 1
return 0 if best == float("inf") else best
What the interviewer cared about: proactively distinguishing the "has negatives" and "all positive" cases. Don't jump straight into a sliding window — it breaks with negative numbers. The negative-number version can be solved in O(n) with prefix sums + a monotonic deque (LeetCode 862).
Round 4: Binary search — minimum inventory threshold
Problem (verbal)
We have a sorted list of daily inventory checkpoints (ascending sorted array). We want to find the first position where the inventory value >= threshold. Return the index of this first element. If all elements < threshold, return -1.
Example: inventory = [2,5,8,12,16,20], threshold = 11, output index 3 (value = 12).
Clarify
- Is the input array strictly sorted ascending?
- Are there duplicate inventory values?
- What if the threshold is smaller than all elements? — Return index 0.
- Empty array? — Return -1.
Approach
Classic lower-bound binary search: keep shrinking the search range to find the first index with value >= threshold. Time O(log n), space O(1).
def first_at_least(inventory, threshold):
lo, hi = 0, len(inventory)
while lo < hi:
mid = (lo + hi) // 2
if inventory[mid] >= threshold:
hi = mid
else:
lo = mid + 1
return lo if lo < len(inventory) else -1
Follow-ups
- What if the array is sorted descending? How do you adjust the binary search condition?
- What is the edge case when multiple equal elements exist?
- If the array is very large and stored on disk (not fully loaded into memory), can binary search still work?
Found this helpful? Let's talk.
Happy to swap interview notes, do mock interviews, or share referral info.

Scan to add me on WeChat
More Amazon notes
View all ›Amazon New Grad Four-Round VO: What Changed This Year + Three Business-Scenario Coding Questions + Bar Raiser Deep DiveAmazon · 2026-10-04›
Amazon New Grad Interview Question: TaskScheduler, Fully Analyzed (Topological Sort)Amazon · 2026-10-02›
Amazon SWE 26NG Four Rounds: Dijkstra Delivery Routes + Sliding Window + Top K Orders + Bar RaiserAmazon · 2026-10-02›
Amazon SWE Four-Round VO (Passed): Bracket Nesting Depth + Group Anagrams + Vending Machine OODAmazon · 2026-10-02›