Design a URL shortening service like TinyURL. Implement two functions:
Your encode and decode functions must be consistent, meaning that calling decode(encode(url)) should always return the original URL.
There is no restriction on how your encode/decode algorithm should work. You just need to ensure that a URL can be encoded to a tiny URL and the tiny URL can be decoded back to the original URL.
Example 1:
Input: url = "https://leetcode.com/problems/design-tinyurl"
Output: "https://leetcode.com/problems/design-tinyurl"
Explanation: decode(encode(url)) should return the original URL.
Example 2:
Input: url = "https://example.com"
Output: "https://example.com"
Explanation: The encode function creates a short URL, and decode restores it.
1 <= url.length <= 10^4url is guaranteed to be a valid URL