InterviewLegend

Design a URL Shortener

Frequently asked
Alex Chen45 min readAdded 19 real interview reports

A URL shortener turns a long address into a short one, like https://s.example/aB3dE9k, and sends anyone who opens it to the original page. It has two operations: create a link and follow a link. Following happens about a hundred times more often than creating. Most write-ups of this problem stop at the code generator. The follow-ups reported for xAI keep going: a flood of clicks on one link, click counts that never slow a redirect, expiring links, and malicious URLs. At our numbers that means hundreds of thousands of redirects a second, with one hot link able to grab a big share of them.

The xAI angle
X already runs one of these. t.co wraps every link posted on X, so expect an interviewer who pictures a short link inside a post, with viral click floods, click counts and phishing on a trusted domain. Some loops run it as design and code, so plan to write the code generator and the redirect handler.

xAIPremium lesson · System design round

The xAI design, worked end to end.

  1. The API and data modelSystem design · Frequently asked
  2. The design, drawn out3 diagrams
  3. 5 deep divesWith the tradeoffs
Get the xAI questions

$49 a year · all 107 companies · instant access

20,000+ candidate reports · guide updated

xAI interview guide

Know what xAI asks before you walk in.

24 coding · 4 system design · 15 behavioral questions

Get Premium$49 a year · Instant access
Or start freeNo card.

Get their questions first.

Had your xAI interview?How we research

InterviewLegend is independent and not affiliated with or endorsed by any company it covers.