We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d5bff2d commit 726ace2Copy full SHA for 726ace2
scripts/algorithms/E/Encode and Decode TinyURL/Encode and Decode TinyURL.cpp
@@ -1,9 +1,10 @@
1
+// Runtime: 4 ms (Top 69.87%) | Memory: 7.4 MB (Top 11.07%)
2
class Solution {
3
private:
4
unordered_map<string, string> hash;
5
string server = "http://tinyurl.com/";
6
string all = "0123456789qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM";
-
7
+
8
public:
9
10
// Encodes a URL to a shortened URL.
@@ -17,9 +18,9 @@ class Solution {
17
18
add += all[index];
19
ran--;
20
}
21
- hash[(server+add)] = longUrl;
22
+ hash[(server+add)] = longUrl;
23
24
return (server + add);
25
26
@@ -31,4 +32,4 @@ class Solution {
31
32
33
// Your Solution object will be instantiated and called as such:
34
// Solution solution;
-// solution.decode(solution.encode(url));
35
+// solution.decode(solution.encode(url));
0 commit comments