File tree 6 files changed +39
-4
lines changed
6 files changed +39
-4
lines changed Original file line number Diff line number Diff line change 86
86
| No196 | [ 196. 删除重复的电子邮箱] ( https://leetcode-cn.com/problems/delete-duplicate-emails/ ) | [ MySql] ( https://github.com/Programming-With-Love/leetcode/blob/master/leetcode/SQL/No196.sql ) | 判断Email相等而且id不能相等。 |
87
87
| No197 | [ 197. 上升的温度] ( https://leetcode-cn.com/problems/rising-temperature/ ) | [ MySql] ( https://github.com/Programming-With-Love/leetcode/blob/master/leetcode/SQL/No197.sql ) | 采用DATEDIFF函数 并且其结果等于1。 |
88
88
89
+ ---
90
+
91
+ ####Hash
92
+
93
+ | # | Title | Solution | Note |
94
+ | ----- | ------------------------------------------------------------ | -------- | ---- |
95
+ | No535 | [ 535. TinyURL 的加密与解密] ( https://leetcode-cn.com/problems/encode-and-decode-tinyurl/ ) | | |
96
+ | | | | |
97
+ | | | | |
98
+
89
99
90
100
Original file line number Diff line number Diff line change 1
- package Algorithm .leetcode .hashtable ;
1
+ package Algorithm .leetcode .hash ;
2
2
3
3
import java .util .HashSet ;
4
4
import java .util .Set ;
Original file line number Diff line number Diff line change 1
- package Algorithm .leetcode .hashtable ;
1
+ package Algorithm .leetcode .hash ;
2
2
3
3
/**
4
4
*
Original file line number Diff line number Diff line change 1
- package Algorithm .leetcode .hashtable ;
1
+ package Algorithm .leetcode .hash ;
2
2
3
3
import java .util .HashSet ;
4
4
import java .util .Set ;
Original file line number Diff line number Diff line change
1
+ package Algorithm .leetcode .hash ;
2
+
3
+ import java .util .HashMap ;
4
+ import java .util .Map ;
5
+
6
+ /**
7
+ *
8
+ * Created by tujietg on Feb 11, 2020
9
+ */
10
+ public class No535 {
11
+
12
+ Map <Integer , String > map = new HashMap <>();
13
+ int i = 0 ;
14
+
15
+ // Encodes a URL to a shortened URL.
16
+ public String encode (String longUrl ) {
17
+ map .put (i , longUrl );
18
+ return "http://tinyurl.com/" + i ++;
19
+ }
20
+
21
+ // Decodes a shortened URL to its original URL.
22
+ public String decode (String shortUrl ) {
23
+ return map .get (Integer .parseInt (shortUrl .replace ("http://tinyurl.com/" , "" )));
24
+ }
25
+ }
Original file line number Diff line number Diff line change 1
- package Algorithm .leetcode .hashtable ;
1
+ package Algorithm .leetcode .hash ;
2
2
3
3
import java .util .HashSet ;
4
4
You can’t perform that action at this time.
0 commit comments