Among North American e-commerce companies, Shopify's OA sits in the "easy to start, hard to ace" bucket. The three problems read like LeetCode Medium, but the platform tucks the real test inside e-commerce business semantics: how to allocate inventory, how to apply discounts, how to surface recommendations. You'll write correct algorithms and still fail hidden tests — usually because the business rule and input boundary weren't aligned. This guide breaks Shopify OA into a three-type matrix, with a code skeleton you can memorize for each.
OA cadence
W0 Career site / referral → resume screen
W1 Recruiter call (15 min) → OA link sent
W2 HackerRank / Codility OA: 60-90 min, 2-3 problems
W3 Tech screen (CoderPad, 1 round, 60 min)
W4 VO Loop (4-5 rounds: coding × 2 + system design + behavioral)
W5 Team match → offer
OA cutoff isn't punishing — full AC with 15+ minutes to spare almost always advances. The trick is hidden tests: Shopify hides e-commerce edge cases inside test sets — empty warehouses, quantity = 0, users who already bought everything. You have to think of these proactively while coding.
Three-type matrix
| Type | Core algo | Business semantic | Frequency |
|---|---|---|---|
| Inventory allocation | Greedy / simulation | Multi-warehouse fulfillment priority | ★★★★★ |
| Tiered discount | Simulation + boundaries | Buy N pay M / BOGO | ★★★★ |
| Recommendation engine | Co-occurrence matrix / graph | Collaborative top-K | ★★★ |
Type 1: Inventory Allocation Optimization
Given an
ordersarray and awarehousesarray, warehouses fulfill in order; once a warehouse runs out of stock it goes inactive. Return the count of unfulfilled items.
orders = [3, 5, 4]
warehouses = [8, 2, 5]
output = 1
The most common stumble: candidates instinctively reach for "use the largest warehouse first." But the spec says iterate warehouses in order — this is simulation, not greedy.
def unfulfilled_items(orders: list[int], warehouses: list[int]) -> int:
unfilled = 0
w_idx = 0
for q in orders:
remaining = q
while remaining > 0 and w_idx < len(warehouses):
take = min(remaining, warehouses[w_idx])
warehouses[w_idx] -= take
remaining -= take
if warehouses[w_idx] == 0:
w_idx += 1
unfilled += remaining
return unfilled
Complexity: O(n + m). Edges: skip a 0-stock warehouse immediately; an order of 0 must not consume any stock.
Type 2: Discounted Price Calculation
Each cart item has price, quantity, and a tiered discount (e.g., "buy 3, pay 2"). Compute the total.
items = [
{"price": 10, "quantity": 5, "discount": (3, 2)},
{"price": 20, "quantity": 2, "discount": None}
]
output = 10 * 4 + 20 * 2 = 80
Trap: 5 items hold one (3,2) group + 2 leftover at full price, so paid count = floor(5/3) * 2 + 5 % 3 = 4. Many candidates write 5 - 5 // 3 and lose the remainder.
def cart_total(items: list[dict]) -> int:
total = 0
for it in items:
price, qty = it["price"], it["quantity"]
d = it.get("discount")
if d:
buy, pay = d
groups = qty // buy
leftover = qty % buy
paid_qty = groups * pay + leftover
else:
paid_qty = qty
total += price * paid_qty
return total
Edges: handle buy = 0, pay > buy (some specs allow gifting more than you bought), and quantity < buy separately.
Type 3: Product Recommendation Engine
Given a purchase matrix
purchases[i][j] = 1meaning user i bought item j, return top-3 co-occurrence recommendations per user, excluding items they've already bought.
from collections import defaultdict, Counter
def recommend(purchases: list[list[int]], k: int = 3) -> list[list[int]]:
n_users = len(purchases)
n_items = len(purchases[0])
cooccur = defaultdict(Counter)
for user in purchases:
bought = [j for j, v in enumerate(user) if v]
for a in bought:
for b in bought:
if a != b:
cooccur[a][b] += 1
out = []
for i in range(n_users):
scores = Counter()
for j in range(n_items):
if purchases[i][j]:
scores.update(cooccur[j])
for j in range(n_items):
if purchases[i][j]:
scores.pop(j, None)
top = [item for item, _ in scores.most_common(k)]
out.append(top)
return out
Complexity: build O(U·B²), recommend O(N·B·I). Trap: the "exclude already-bought" filter must run last — otherwise it pollutes the score table.
OA pacing (90-minute version)
00:00 - 00:05 Skim all 3 problems, pick the most familiar to do first
00:05 - 00:25 Q1 simulation / array → 100% AC
00:25 - 00:55 Q2 business modeling → 80%+ AC
00:55 - 01:20 Q3 data structure → 50%+ AC
01:20 - 01:30 Sweep hidden edges (empty input, single element, all-zero)
Reserving the last 10 minutes for business-edge sweeps is unique to Shopify OA: dropping if not orders: return 0 into the main path is often the difference between 220 and 280.
Role-line variation
| Role line | Question lean | Duration | Platform |
|---|---|---|---|
| Backend SDE | Inventory + discount sim | 60-90 min | HackerRank |
| Data / ML | Recommendation + matrix | 90 min | HackerRank |
| SRE / Infra | Rate limiter / queue sim | 75 min | Codility |
| Frontend | DOM tree + JS API | 60 min | HackerRank |
If your problem reads "order processing pipeline simulation," it's almost certainly Backend SDE. If you see a users × items matrix, you're in the Data / ML lane.
OA assist plug-in points for Shopify
Shopify OA's pain isn't the algorithm — it's business edges + hidden tests. The OA assist (OA assist (OA live support)) cadence on this lane:
- Role-line scoping — JD keywords (Liquid / Rails / Hydrogen) decide SDE / Data / Frontend lane
- Question-type forecasting — pre-mock the two highest-frequency types out of inventory / discount / recommendation
- Timed mock — 90-min simulation, drilling the "last 10 minutes for edge sweep" rhythm
- Live cueing — backstage skeleton + hidden-test hints during the real OA
- Debrief — replay submission, reconcile shown score vs actual AC
FAQ
Q1: What's the Shopify OA cutoff? A: HackerRank shows a score per problem (often 300). The pass line is around 220-240; full AC across 3 problems with edge coverage almost always clears it.
Q2: Can I pick my language? A: HackerRank offers 15+ languages. Shopify recommends Python / Ruby / JavaScript / Go. Submitting Ruby for backend roles wins a small culture point.
Q3: Is there plagiarism detection? A: Yes. HackerRank's built-in similarity check plus Shopify's historical-submission comparison. Pasting from solution sites flags you.
Q4: How long until the tech-screen invite arrives? A: Usually 5-7 business days. If 10 days pass, a polite recruiter follow-up is fair.
Q5: How do I prioritize if I can't finish all three? A: Lock Q1 and Q2 at full AC; partial cases on Q3 are fine. Shopify weighs completeness over count.
Closing
What's worth training for Shopify OA isn't the algorithm — it's translating e-commerce rules into code. If you're prepping Shopify OA, message WeChat Coding0201 with the JD and your current stage. We'll scope the role line first, then schedule the OA assist / OA live support cadence.
Need real interview material? Add WeChat Coding0201 now to request access.
Contact
- WeChat: Coding0201
- Email: [email protected]
- Telegram: @OAVOProxy