Should you allow the user to create a TinyURL of an existing TinyURL?
https://leetcode.com/problems/design-tinyurlis shortened to
What should be done to shorten
http://tinyurl.com/4e9iAkto say, for example,
Should you allow the user to force shortening of a long URL to multiple tiny URLs?
What could be the advantages/disadvantages?
Some of the points I feel-
Advantages: User can get a sense of encrypting/customizing a commonly available TinyURL.
Disadvantages: There can be a loop between the redirection of URL, similar to a loop in LinkedList. This might cause the system to hang forever.
Increased time and space complexity.
Why is there a loop? can you explain your design that can cause a loop?
browsers usually have a redirect limit. If the tinyURL service responds with HTTP 301 + shortURL, browser will redirect up to its limit, then throw 310 ERROR. also too many redirects will increase latency. IMO shortening tinyURL loses its original purpose, so shouldn't be allowed.