Write a URL shortner.

Write a URL shortner (like tinyurl) . Take a URL as input & return a shortened URL. If you use any kind of storage or persistence, please use the appropriate API’s of the language. Another requirement is that we want to make our URLs as different as possible, so that successive calls return very different URIs
This is to ensure that small typo errors do not lead to users getting to a valid URL, but rather throwing up an error page.

Let start with the design 🙂 and then come up with an implementation probably in Java/C etc.

The interviewer asked me to implement it in Java.

Small Note: Googling for this can give you a code written in PHP right away as your first link :-), please dont start with it. Come up with your own logic.