LeetCode:535. Encode and Decode TinyURL
2017-03-23 19:02
507 查看
Note: This is a companion problem to the System Design problem: Design
TinyURL.
TinyURL is a URL shortening service where you enter a URL such as
it returns a short URL such as
Design the
for the TinyURL service. 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 to the original URL.
Subscribe to see which companies asked this question.
Show Tags
Show Similar Problems
其实我不明白这道题的出题想干什么;
AC:
TinyURL.
TinyURL is a URL shortening service where you enter a URL such as
https://leetcode.com/problems/design-tinyurland
it returns a short URL such as
http://tinyurl.com/4e9iAk.
Design the
encodeand
decodemethods
for the TinyURL service. 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 to the original URL.
Subscribe to see which companies asked this question.
Show Tags
Show Similar Problems
其实我不明白这道题的出题想干什么;
AC:
class Solution { public: // Encodes a URL to a shortened URL. string encode(string longUrl) { return longUrl; } // Decodes a shortened URL to its original URL. string decode(string shortUrl) { return shortUrl; } }; // Your Solution object will be instantiated and called as such: // Solution solution; // solution.decode(solution.encode(url));
相关文章推荐
- Leetcode 535. Encode and Decode TinyURL
- leetcode 535. Encode and Decode TinyURL
- LeetCode 535: Encode and Decode TinyURL
- LeetCode 535. Encode and Decode TinyURL对随机编码的思考
- 20170613-leetcode-535-Encode and Decode TinyURL
- leetcode535 Encode and Decode TinyURL java
- leetcode题解-535. Encode and Decode TinyURL
- 【LeetCode】535. Encode and Decode TinyURL
- Leetcode刷题之路(Python)——535. Encode and Decode TinyURL
- LeetCode 535 Encode and Decode TinyURL (HashMap)
- Leetcode 535 Encode and Decode TinyURL
- leetcode 535. Encode and Decode TinyURL
- python--leetcode 535. Encode and Decode TinyURL
- 【LeetCode】535. Encode and Decode TinyURL
- 535. Encode and Decode TinyURL
- LeetCode Encode and Decode TinyURL
- LeetCode-Encode and Decode TinyURL
- 535. Encode and Decode TinyURL
- 535 Encode and Decode TinyURL
- 535. Encode and Decode TinyURL