AI & Technical question
How does TinyURL work?
- AI & Technical
- Easy
Practice this question out loud. An AI interviewer asks it, follows up like a real interviewer would, and scores your answer. Type or speak.
Start a mock interview on this question · Mock interview from a job description
What this question tests
A PM-facing technical explainer question testing whether the candidate can describe a simple system's mechanics clearly enough to reason about its trade-offs, not deep implementation detail.
How to approach it
- State the goal: TinyURL takes a long URL and returns a short, unique alias that redirects to the original when visited.
- Explain the core mechanism: when a long URL is submitted, the service generates a short unique key (e.g., a 6-7 character code) and stores a mapping from that key to the original URL in a database.
- Explain key generation: either a counter-based approach (base62-encoding an incrementing ID) or a hash-based approach (hashing the URL and taking a short prefix, checking for collisions).
- Explain the redirect flow: when someone visits the short URL, the service looks up the key in the database and issues an HTTP redirect (301 or 302) to the original long URL.
- Discuss trade-offs as a PM would: 301 (permanent) redirects are cacheable and faster but lose the ability to track click analytics on every visit, while 302 (temporary) redirects allow tracking every click, which matters if analytics is a product goal.
- Mention scaling considerations: the lookup needs to be fast at high read volume, so a key-value store or cache (e.g., Redis) in front of the database is a natural choice.
What a strong answer includes
- Explains both key generation approaches (counter-based vs hash-based) and their trade-offs (collision risk, predictability) rather than a vague 'it generates a short code.'
- Connects a technical choice (301 vs 302 redirect) to a product decision (whether click analytics matters), showing PM-relevant technical judgment.
- Mentions caching/read-scaling as a natural evolution, showing awareness of what changes at scale.
- Keeps the explanation at the right altitude: clear systems thinking without pretending to write actual code.
Common mistakes
- Explaining it purely as 'it stores a mapping' with no detail on key generation or redirect mechanics.
- Missing the 301 vs 302 trade-off entirely, which is the most PM-relevant technical decision in this system.
- Overcomplicating the explanation with unnecessary distributed-systems jargon not asked for.
Likely follow-up questions
- How would you prevent short-code collisions at scale?
- How would you design this to support custom/branded short URLs?
- How would you handle link expiration or abuse (spam/malicious URLs)?
More ai & technical questions
- Design a simple load balancer for Google.com. What data structures would you use?Google · AI & Technical · Hard
- How would you explain cloud computing to your grandmother?Google · AI & Technical · Easy
- What happens when you enter a URL in your browser?Google · AI & Technical · Easy
- You’re part of the Google Search web spam team. How would you detect duplicate websites?Google · AI & Technical · Hard
- Explain the data pipeline for the last AI project you worked on. What were the top challenges in getting data, and how did you resolve them?Google · AI & Technical · Hard
- How would you implement the sync feature of Google Drive app or Google Docs? How would you design the DB for G-drive?Google · AI & Technical · Hard
More questions from Google
Learn the skill behind it
Chapters of the AI PM course that teach what this question tests.
- Chapter 1: Foundations: the model and the decisions it forces on you
- Chapter 8: Evals: define good and make the number defensible
- Chapter 6: Agents and agentic architecture