Section 1: Two Questions Wearing One Costume - Problem Understanding & Clarifications
Executive Summary: This section covers the first ten minutes of the interview, the part that decides the other fifty. We read ClipKart's prompt closely, break it down by what, who, why and how, and find the insight the rest of the module depends on: the "Top 10 in the last N hours" button needs only the head of a list, minutes-fresh, over exact sliding windows, while the best-seller rank needs the entire order of every category but can be an hour old. Then six clarifying questions settle what "most bought" means, what counts, the scopes, freshness, exactness and geography. We name the two ways candidates fail this prompt and meet Priya, whose cricket helmet we'll follow through every section.
The interviewer turns the laptop around and reads:
"You're working on ClipKart.com, a large e-commerce platform. We want two things. First, a button: click it and you see the Top 10 most-bought products in the last N hours, where N is 1, 4 or 24. Second, best-seller ranks: every product should know where it stands, overall and in each of its categories. One product might be the #1,056th best-seller overall but #13 in Sports Equipment and #24 in Safety. Design the system."
"Top 10" sets off a reflex in most prepared candidates. The whiteboard quickly fills with a min-heap of size K, a Count-Min Sketch, and maybe a MapReduce merge. That answers half of the first sentence. It says nothing about the second feature, and the second feature contains a number no heap can produce: #1,056.
Key Insight: Read the prompt as two separate requests. The interviewer packed two features with different shapes into one paragraph on purpose. They want to see whether you notice before you start drawing boxes.
Decomposing the Prompt
Before you ask anything, break the territory down out loud. It takes a minute and gives you both a shared picture.
- What it does: It counts purchases and orders products by those counts, in two different ways. One is a short list over a sliding time window. The other is a position for every product within every category it belongs to.
- Who uses it: Shoppers who click the button. The product detail page (PDP), which shows a rank badge on every product. Category best-seller pages. Merchandising teams who curate around the lists. And one group that's easy to miss: sellers, who care a lot about that badge.
- Why it exists: Social proof. "Best seller" is one of the strongest conversion signals in e-commerce, and that's exactly why the badge is commercially valuable. Anything valuable attracts people who will try to game it. You've found the integrity problem before writing any requirements.
- How it's used: A click that expects a list right away, and a badge rendered on every product page. The rank read is the busier one by far, which Section 3 will quantify.
Sign in to continue reading
The rest of this lesson is available with a free account. Signing in with Google or Microsoft is free.
Sign in to read the full lesson