Plenty of people have been discussing this year's Amazon summer intern OA, and most of it is still the same recurring set with little change. Here I've organized two new questions I ran into, hoping to help those preparing.
The process is the usual: you do it on HackerRank, take a photo for ID verification at the start, and after that the whole process needs no camera or screen sharing. Test cases include hidden ones, scored by the number of passing cases. After the coding questions comes the Work Simulation.
Amazon Intern OA Cheat Sheet
| Dimension | Detail |
|---|---|
| Platform | HackerRank |
| ID verification | Photo at start, no camera afterward |
| Question count | 2 coding + Work Simulation |
| Duration | Coding ~60-90 minutes |
| Scoring | By number of passing hidden cases |
Question 1: Warehouse Robot Shortest Path (BFS)
Problem
A simulation of Amazon's most typical fulfillment-center planning problem. Given a 2D grid of 0s and 1s: 0 is a passable road, 1 is an obstacle. Given a robot's start and the target package position, return the shortest path length from start to target; return -1 if unreachable.
Approach
For a shortest path on a grid (uniform step cost), BFS is the go-to: expand layer by layer from the start; the layer at which you first reach the target is the shortest distance. Use a queue of (row, col, distance) and a visited set to avoid re-enqueuing.
Python Solution
from collections import deque
def shortest_path(grid, start, target):
rows, cols = len(grid), len(grid[0])
sr, sc = start
tr, tc = target
if grid[sr][sc] == 1 or grid[tr][tc] == 1:
return -1
queue = deque([(sr, sc, 0)])
visited = {(sr, sc)}
while queue:
r, c, dist = queue.popleft()
if (r, c) == (tr, tc):
return dist
for dr, dc in ((1, 0), (-1, 0), (0, 1), (0, -1)):
nr, nc = r + dr, c + dc
if 0 <= nr < rows and 0 <= nc < cols \
and grid[nr][nc] == 0 and (nr, nc) not in visited:
visited.add((nr, nc))
queue.append((nr, nc, dist + 1))
return -1
Why not DFS: DFS does not necessarily find the shortest path and must backtrack across all paths to confirm the minimum; BFS expands by layer, so the first arrival is the shortest, with better complexity.
Time: O(rows × cols) Space: O(rows × cols)
Question 2: Server Load Distribution Simulation (Greedy + Heap)
Problem
More aligned with the content-distribution logic behind Amazon Prime Video. Given the current load of N servers, the system adds K requests at a time; simulate the distribution: each time, assign the new request to the server with the lowest current load, update its load, then continue. After M rounds, return the final load state.
Approach
Repeatedly taking the "lowest load" is the classic min-heap scenario. Push (load, server_id) into the heap; each time pop the minimum, add the request amount, and push back.
Python Solution
import heapq
def distribute_load(loads, requests):
# loads: initial load list; requests: amount added each round
heap = [(load, i) for i, load in enumerate(loads)]
heapq.heapify(heap)
for req in requests:
cur_load, idx = heapq.heappop(heap) # take the lowest load
heapq.heappush(heap, (cur_load + req, idx))
result = [0] * len(loads)
for load, idx in heap:
result[idx] = load
return result
Why a heap over scanning each time: scanning linearly for the minimum is O(N), O(M·N) total; a heap drops a single extract-min to O(log N), for O(M log N) overall — a clear gap when N and M are large, which is exactly where the hidden cases hit TLE.
Time: O((N + M) log N) Space: O(N)
Handling the Work Simulation
The Work Simulation after the coding questions is much simpler — think of it as a multiple-choice situational judgment test (SJT), untimed, with fairly fixed logic. Answer around Amazon's Leadership Principles (Customer Obsession, Ownership, Bias for Action, etc.) and you'll pass comfortably.
Prep Strategy
| Skill | Focus | LeetCode |
|---|---|---|
| Grid BFS | Shortest path, layer expansion | 1091, 994, 542 |
| Heap / greedy | Dynamic extreme extraction | 1167, 215, 1834 |
| IO template | HackerRank stdin reading | — |
| Complexity awareness | Rule out O(M·N) for large N | — |
FAQ
Q1: What platform is the Amazon intern OA on? Do I need the camera on throughout? On HackerRank. You take a photo for ID verification at the start, and after that the whole process needs no camera or screen sharing. After the coding questions there is a Work Simulation.
Q2: How many questions are in the Amazon intern OA, and how hard? Usually 2 coding questions + 1 Work Simulation. The coding is mostly LeetCode medium, with business-grounded problems like grid BFS and load distribution; the difficulty is usually complexity optimization rather than the idea.
Q3: Why use BFS instead of DFS for the warehouse shortest-path question? For a uniform-cost grid shortest path, BFS expands by layer, so the first arrival at the target is the shortest, with O(rows×cols) complexity. DFS does not guarantee the shortest path and must backtrack all paths, which is less efficient.
Q4: How do I avoid TLE on the server load distribution question? Use a min-heap to dynamically take the lowest-load server, O(log N) per operation, O(M log N) total. Scanning linearly for the minimum each time is O(M·N) and will time out on large hidden cases.
Q5: How should I prepare for the Work Simulation? It is an untimed situational-judgment multiple-choice test; answer around Amazon's Leadership Principles, prioritizing Customer Obsession and Ownership. The logic is fixed, so reading carefully will basically keep you error-free.
Preparing for the Amazon intern OA?
If you're not yet fluent with HackerRank IO, keep hitting TLE on grid BFS or heap optimization, or want someone to check the platform process and rehearse question types with you, let's talk through a full OA assistance plan — from question breakdowns to complexity optimization, end to end.
Contact
Need real interview questions and a custom prep plan? Message WeChat Coding0201 now and get the questions.
Email: [email protected] Telegram: @OAVOProxy