Create a URL shortening service, then change it to use alphanumeric values as the path.
Asked in the coding interview stage. 1 hour.
Implement url_shortener(operations). Each operation is a dictionary with op equal to shorten or resolve, and url or path respectively. Return one result per operation: shorten returns a unique alphanumeric path, while resolve returns the original URL. Shortened paths must use base-62 encoding and remain unique during the call.
def url_shortener(operations):