Shopify Coding Interview Questions
25 Shopify coding interview problems with full optimal solutions — 4 easy, 20 medium, 1 hard. Every problem ships with multiple approaches (brute-force first, then the optimal), complexity tables for each, company-specific tips on what an Shopify interviewer values, and a FAQ section.
- #1easyfoundational
1. Two Sum
Shopify uses Two Sum as the warm-up before pivoting into a follow-up about hash-map collisions or a real product scenario like 'find two SKUs whose price sums to a coupon target'. The interviewer is grading whether you narrate the O(n^2) -> O(n) tradeoff out loud.
3 free resourcesSolve → - #3mediumfrequently asked
3. Longest Substring Without Repeating Characters
Shopify uses this to test sliding-window mastery. Whether the candidate uses Set vs Map for state and whether they advance the left pointer correctly are the two grading bars.
3 free resourcesSolve → - #15mediumfrequently asked
15. 3Sum
3Sum is Shopify's classic two-pointer follow-up to Two Sum. The interviewer wants you to sort, fix one element, and two-pointer the remainder — and to handle duplicate-skipping cleanly.
4 free resourcesSolve → - #20easyfoundational
20. Valid Parentheses
Shopify uses Valid Parentheses to test whether you instinctively reach for a stack on a matching-pairs problem. Expect the follow-up to extend to template strings or Liquid-style nested tags — Shopify's storefront templating engine — so the data-structure choice has to scale.
3 free resourcesSolve → - #23hardfrequently asked
23. Merge K Sorted Lists
Merge K Sorted Lists is Shopify's heap-vs-divide-and-conquer hard. Real motivation: merging time-ordered event streams from K shards into one chronological feed. The interviewer is grading whether you discuss BOTH approaches.
4 free resourcesSolve → - #49mediumfrequently asked
49. Group Anagrams
Group Anagrams shows up at Shopify because product-search ranking and tag-deduplication both reduce to 'bucket by canonical key'. The interviewer is grading whether you pick the right hash key (sorted string vs char-count tuple) and explain the time tradeoff.
3 free resourcesSolve → - #56mediumfrequently asked
56. Merge Intervals
Shopify asks Merge Intervals because order-fulfillment, calendar slot bookings, and inventory windows all reduce to it. The interviewer wants to see you sort first, then sweep — and explain why a hash map or graph would be wrong tools here.
4 free resourcesSolve → - #121easyfoundational
121. Best Time to Buy and Sell Stock
Shopify uses this to test whether you recognize 'max profit so far' as a single-pass DP and avoid the O(n^2) two-loop. The interviewer is grading the explanation of the running-minimum invariant.
3 free resourcesSolve → - #128mediumfrequently asked
128. Longest Consecutive Sequence
Shopify uses this to grade whether you spot the 'only start a chain at a candidate that's NOT preceded by val-1' trick. Without it, the obvious set-walk is O(n^2); with it, it's O(n).
3 free resourcesSolve → - #138mediumfrequently asked
138. Copy List with Random Pointer
Shopify uses Copy List with Random Pointer to test whether you can solve a deep-clone problem with a hash map first, then optimize to O(1) extra space with the interleaving trick. It mirrors real cloning needs in template/product structures with cross-references.
4 free resourcesSolve → - #139mediumfrequently asked
139. Word Break
Shopify uses Word Break to test DP intuition. Real motivation: 'is this discount-code string composed entirely of valid SKU tokens?' or 'can we segment this search query into known product names?'.
4 free resourcesSolve → - #146mediumcompany favorite
146. LRU Cache
LRU Cache is Shopify's canonical 'design a data structure' round. Storefronts have heavy cache eviction needs (product pages, theme assets, session tokens), so the interviewer is grading whether you reach for the doubly-linked-list + hash-map combo and explain why neither alone gives O(1) get + put.
4 free resourcesSolve → - #200mediumfrequently asked
200. Number of Islands
Number of Islands is Shopify's canonical graph-traversal interview. The interviewer grades whether you reach for BFS or DFS naturally and discuss the stack-overflow risk on huge grids.
4 free resourcesSolve → - #207mediumfrequently asked
207. Course Schedule
Course Schedule is Shopify's dependency-graph round. Real motivations: 'can the install order for these app packages succeed?' or 'do these merchant onboarding steps cycle?'. The interviewer wants topological sort or cycle detection by DFS.
4 free resourcesSolve → - #208mediumfrequently asked
208. Implement Trie (Prefix Tree)
Shopify uses Trie design to test whether you know when to reach for prefix trees vs hash maps. Product autocomplete, tag suggestions, and discount-code prefix lookup are all real motivations.
4 free resourcesSolve → - #238mediumfrequently asked
238. Product of Array Except Self
Shopify likes Product of Array Except Self because the constraint 'no division, O(n) time' forces candidates to invent the prefix/suffix pattern from scratch. It's also a stand-in for analytics pipelines where you need 'total minus this slice' fast.
3 free resourcesSolve → - #253mediumcompany favorite
253. Meeting Rooms II
Shopify reframes this as 'how many fulfillment workers do we need to handle overlapping order windows?' It's the canonical sweep-line + heap or chronological-events problem in Shopify's onsite loop.
4 free resourcesSolve → - #322mediumfrequently asked
322. Coin Change
Shopify uses Coin Change to test unbounded knapsack DP. Real motivation: 'minimum number of coupon denominations to refund this amount'. The interviewer wants you to NOT reach for greedy and to explain why.
4 free resourcesSolve → - #347mediumfrequently asked
347. Top K Frequent Elements
Shopify asks Top K Frequent Elements because 'top K best-selling products', 'top K search queries', and 'top K traffic sources' are bread-and-butter analytics. The interviewer wants you to choose between heap and bucket sort and articulate the tradeoff.
3 free resourcesSolve → - #355mediumfrequently asked
355. Design Twitter
Shopify maps this to 'design a merchant activity feed': merge K time-ordered streams (posts, orders, reviews) into one feed. The interviewer wants you to combine hash maps for the follow graph with a heap for the merged-feed read.
4 free resourcesSolve → - #362mediumcompany favorite
362. Design Hit Counter
Hit Counter is Shopify's rate-limiting interview classic. Storefronts log billions of hits per day, so the interviewer is grading whether you pick the right circular-buffer representation and discuss thread-safety and scale on the follow-up.
3 free resourcesSolve → - #380mediumfrequently asked
380. Insert Delete GetRandom O(1)
Shopify asks this to test whether you can combine a hash map with an array to achieve O(1) on three operations that pull in opposite directions. It's the data-structure design round Shopify favors for backend candidates — A/B-test variant sampling, random product pickers, raffle systems all reduce to it.
4 free resourcesSolve → - #535mediumfrequently asked
535. Encode and Decode TinyURL
Shopify uses the TinyURL design to grade whether you can pick a reasonable encoding scheme and reason about collisions, scale, and persistence — the same concerns that drive Shopify's checkout permalink and short-link systems.
4 free resourcesSolve → - #560mediumfrequently asked
560. Subarray Sum Equals K
Shopify uses this to grade whether you recognize prefix-sum + hash-map as one pattern. Real-life mirror: 'count promotion windows whose cumulative revenue equals exactly K dollars'. The interviewer wants the O(n) hashmap version, not the O(n^2) two-loop.
3 free resourcesSolve → - #1268easyfrequently asked
1268. Logger Rate Limiter
Shopify's lightest rate-limiting design. Real motivation: throttle warning logs from a misbehaving merchant integration so the log pipeline doesn't get DOSed. The interviewer wants to see a hash-map design and a clear answer on memory growth.
4 free resourcesSolve →
Related interview-prep guides
Hatchways Tech Interview Assessment: The Complete 2026 Guide for Early-Career Devs
Hatchways is a project-based assessment and portfolio platform aimed at early-career developers: bootcamp grads, recent CS grads, and junior engineers funneled through Springboard's hiring partner network since the 2022 acquisition. Assessments take hours to days, not minutes, and the artifact reviewers see is a deployed app plus commit history plus an optional video walkthrough.
Replit for Tech Interviews in 2026: The Full-IDE Take-Home Guide
Replit-for-hiring is the full-IDE take-home format. The candidate gets a forked Repl, hours or days to ship a working project, and a commit history the reviewer will scrutinize line-by-line. This guide breaks down what Replit captures, what it doesn't, and how a desktop AI setup pairs with the multi-day window.
Spark Hire Async Video Interview Guide for Tech Jobseekers (2026)
Spark Hire is a mid-market async video interview platform used by 6,000+ employers across tech, healthcare, retail, and education. Candidates record video answers to pre-recorded prompts within configurable time budgets, and hiring teams review the recordings asynchronously. Lighter on AI scoring than HireVue, heavier on human review.