returns long URL associated and redirect with 301 response status code
High-Level Design
clinet - URLshortner server - url server, hash function , database
Detailed Component Design
Database - Key-value pair (short URL - Long URL). why not hash table (because its a in-memory store and in long term it will be limited and won't be expandable and feasible for production ready systems, data persistence in not gurenteed in an in memory db as it loses when the system crashes or restarted etc..) - Use relational Database - reliable, persitent data, scalable, consistent, multi-user coprative
Hash function - used to hash the lng url into short url
hash value will consist a-zA-Z0-9 charaters (total 62 characters)
to generate 100 million * 365 days * 10 years = 365 billion URLs - 62^n >= 365 billion = n=7 that means 7 character length would be enough to create these many URls
generate a hashfunction that will take the long URL and create short URL code