Skip to content

Commit 726ace2

Browse files
committed
Runtime: 4 ms (Top 69.87%) | Memory: 7.4 MB (Top 11.07%)
1 parent d5bff2d commit 726ace2

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

scripts/algorithms/E/Encode and Decode TinyURL/Encode and Decode TinyURL.cpp

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
// Runtime: 4 ms (Top 69.87%) | Memory: 7.4 MB (Top 11.07%)
12
class Solution {
23
private:
34
unordered_map<string, string> hash;
45
string server = "http://tinyurl.com/";
56
string all = "0123456789qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM";
6-
7+
78
public:
89

910
// Encodes a URL to a shortened URL.
@@ -17,9 +18,9 @@ class Solution {
1718
add += all[index];
1819
ran--;
1920
}
20-
21-
hash[(server+add)] = longUrl;
22-
21+
22+
hash[(server+add)] = longUrl;
23+
2324
return (server + add);
2425
}
2526

@@ -31,4 +32,4 @@ class Solution {
3132

3233
// Your Solution object will be instantiated and called as such:
3334
// Solution solution;
34-
// solution.decode(solution.encode(url));
35+
// solution.decode(solution.encode(url));

0 commit comments

Comments
 (0)