Practice Encode and Decode TinyURL
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Implement the Solution URL codec with encode(longUrl), which returns a short URL identifier, and decode(shortUrl), which returns its original long URL. The encoding format is unrestricted, but decoding must recover the exact input. A decode call receives a URL previously produced by encode on the codec.
Source: Encode and Decode TinyURL on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
url = "https://leetcode.com/problems/design-tinyurl"
Output
"https://leetcode.com/problems/design-tinyurl"
Constraints
1 <= url.length <= 10^4
url is guranteed to be a valid URL.
Related LeetCode Problems
Practice more problems similar to Encode and Decode TinyURL.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.