System Design
Mid
system_design
**Design a URL Shortener** \nBackground: A URL shortener takes a long URL and converts it into a shorter, unique URL that redirects to the original URL. This process makes sharing URLs easier, especially on platforms with character limits. \nProblem Statement: Design a URL shortening service with the following functionalities: `shorten(url: String): String` to shorten a URL and `retrieve(shortened: String): String` to retrieve the original URL. Focus on scalability, storage, and handle issues like collisions. \nConstraints: The service should support up to billions of URLs and provide low latency.
Suggested Answer