Design a File Upload Feature
A user drags a PDF into a chat window and asks a question about it. That one gesture is the whole prompt, and it hides two systems that happen to share a button. The first is an ordinary large-file upload service. It accepts bytes reliably over a flaky network, stores them durably, and never loses or corrupts a file. The second exists only because the other side is a model. It takes those bytes, pulls text out of them, and fits that text into a context window far smaller than the file. Name both halves early. A candidate who designs only the upload plumbing has answered a generic question. One who jumps straight to the model has skipped the durability the feature stands on.
Work outward from the file itself. It can be large, so it will not arrive in one request and cannot be held in memory. It comes from a browser on a home connection, so the transfer will break and has to resume rather than restart. It is untrusted. Anyone can upload anything, so it has to be scanned before the system leans on it. And it is destined for a model with a hard context limit, so its text has to be extracted and cut down to fit. Big, flaky, hostile, bound for a small window. Those four facts drive every decision that follows. Pin them first, then draw boxes.
- 1 problem, worked step by step
- 1 diagram
- about 24 min
Premium lessonxAI interview guide
These took digging.
What candidates walked out with, from 20,000+ reports, forum threads behind logins and write-ups in Chinese. Then solved step by step.
100 companies. Checked every month.
Unlock all 100 companies$49 a year · less than $1 a week · Cancel anytime
xAI interview guideKnow what xAI asks before you walk in.
8 coding · 2 system design · 15 behavioral questions
Get their questions first.
InterviewLegend is independent and not affiliated with or endorsed by any company it covers.