Layer 3 · Go deeper · 8 min
Go deeper
Size it, build it, then make the calls an interviewer will push you on.
Back of the envelope
Size it up
Tap through each step of the arithmetic.
Does a keyword-stuffed listing outrank an honest kurta title?
How much memory does one cached filter take?
Build-up · 5 steps
Build the index from four Bazaar titles
Analyse four product titles, flip them into postings lists, then answer an AND and a phrase query. Every list stays sorted by doc ID.
Step 1 of 5
Four titles, four doc IDs
D1 to D4 are small, dense integers in insertion order, not product IDs. That density makes gap encoding and bitsets work; 32-bit IDs cap one shard at about 2.1 billion documents.
4 interview moments
You’re the candidate
The interviewer pushes on the hard parts. Pick an approach and see how it holds up.
Deep dive 1 of 4
Interviewer
“Bazaar wants the 5–10 most popular completions of a prefix on every keystroke, within a few milliseconds. What do you build?”
Your move. Pick an approach:
Deep dive 2 of 4
Interviewer
“Typo tolerance is on, but fuzzy queries crawl as the term dictionary grows. How should the engine find terms near kurtha?”
Your move. Pick an approach:
Deep dive 3 of 4
Interviewer
“Shoppers filter kurtas by price, 300 to 500 rupees, across 50 million products. How do you index price?”
Your move. Pick an approach:
Deep dive 4 of 4
Interviewer
“Bazaar sorts matching kurtas by price and counts sizes for the sidebar. Where should those values come from?”
Your move. Pick an approach: