Hierarchy and Duplicate TinyURLs


  • 0
    L
    1. Should you allow the user to create a TinyURL of an existing TinyURL?
      Example: https://leetcode.com/problems/design-tinyurl is shortened to http://tinyurl.com/4e9iAk.
      What should be done to shorten http://tinyurl.com/4e9iAk to say, for example, http://tinyurl.com/4f0jBl?

    2. 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.


  • 0
    G

    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.


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.