educative.io

TinyURL design::Hashing

Hello, I am trying to understand the design of TinyURL and ran into this question. Can you help me with clarification?

In the different issues section, It is noted

If multiple users enter the same URL, they can get the same shortened URL, which is not acceptable.

I am trying to understand why is it not acceptable, Is it because the system would not know who made the request or which dev key made the request? Why is it not acceptable to have the same TinyURL for 2 users for the same website.

1 Like

Hi @Karthik3,

Hope you are doing well.

First, it is important to note that, technically speaking, there is no problem in providing the same TinyURL for the same URL. So, this is a business rule that should be followed and, therefore, discussed with the interviewer.

The reason for create a unique TinyURL even for same URL in a system like that, probably is to keep tracking of the stats about clicks, visualization, which user shared which content, etc. But again, always discuss business rules with the interviewer. It is not unusual they ask for different features of popular questions (like this one) in order to evaluate your knowledge and make sure you didnt just memorized the solution.

Hope that helps!

Regards,
Artur (Twitter @abaruchi)

1 Like