776 Commits

Author SHA1 Message Date
8762376692 Bump golang.org/x/net from 0.7.0 to 0.17.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.7.0 to 0.17.0.
- [Commits](https://github.com/golang/net/compare/v0.7.0...v0.17.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-11 23:26:57 +00:00
3200de1f73 Update 2023-04-07 21:02:06 -07:00
8a2e480bd7 Update 2023-04-06 22:03:49 -07:00
beebea895a Update 2023-04-06 22:00:44 -07:00
b0ac301cea Modify the name of 0491 question 2023-04-06 21:18:13 -07:00
171c28a1ca Add max function in 1004 2023-04-06 21:06:11 -07:00
796861bad7 Merge pull request #272 from hezhizhen/patch-1
fix typo
2023-04-06 21:02:52 -07:00
25b83a9e22 Merge pull request #271 from cuishuang/master
修复描述
2023-04-06 21:01:04 -07:00
bd1ebb98f8 Merge pull request #267 from halfrost/dependabot/go_modules/golang.org/x/net-0.7.0
Bump golang.org/x/net from 0.0.0-20220909164309-bea034e7d591 to 0.7.0
2023-04-06 21:00:06 -07:00
ef6966196b Update 2023-04-06 18:17:43 -07:00
b671586297 Update 2023-04-06 18:17:22 -07:00
6c29facbea Update 2023-04-06 18:16:55 -07:00
0907f80677 Update 2023-04-06 18:16:05 -07:00
eb2aae405e Update 2023-04-06 17:44:12 -07:00
ff54bb6b15 Update 2023-04-06 16:45:53 -07:00
7575251ff0 Update 2023-04-06 16:44:45 -07:00
e0903e70b7 Update 2023-04-06 16:44:08 -07:00
1c804f7581 Update 2023-04-06 16:40:15 -07:00
47605787fd fix typo 2023-04-06 14:01:40 +08:00
6d04d15e38 修复描述 2023-04-03 21:25:38 +08:00
5333a1a299 Update 2023-03-27 22:32:09 -07:00
9553d414bd Update 2023-03-27 22:28:09 -07:00
2f2fcd5a4c Update 2023-03-27 22:24:39 -07:00
ba5db0c731 Update 2023-03-27 22:24:11 -07:00
d432ddbb31 Update 2023-03-27 22:23:42 -07:00
c97a69bc5c Update 2023-03-27 22:23:23 -07:00
613bf05fe4 Update 2023-03-27 22:23:06 -07:00
7aa47218b7 Update 2023-03-27 22:22:44 -07:00
6dd9ea0961 Update 2023-03-27 22:17:24 -07:00
3145e8d266 Update 2023-03-27 22:17:01 -07:00
37fb0753fb Update 2023-03-27 22:16:43 -07:00
527f8a2ee6 Update 2023-03-27 22:16:24 -07:00
ec64e989bf Update 2023-03-27 22:16:06 -07:00
051cba1503 Update 2023-03-27 22:15:18 -07:00
eb82b672c0 Update 2023-03-27 22:15:01 -07:00
6510001f2e Update 2023-03-27 21:23:36 -07:00
aba234f7a9 Update 2023-03-27 21:23:19 -07:00
f7b7af2972 Update 2023-03-27 21:22:55 -07:00
dfb1d3f137 Update 2023-03-27 21:22:05 -07:00
8250a2ce57 Update 2023-03-27 21:19:46 -07:00
6880856a56 Update 2023-03-27 21:18:26 -07:00
a56068179a Update 2023-03-27 21:17:18 -07:00
1158ad7247 Update 2023-03-27 21:16:27 -07:00
c68cf7e402 Update 2023-03-27 21:16:10 -07:00
123438a8d0 Update 2023-03-27 21:15:14 -07:00
2db6079dcb Update 2023-03-27 20:42:07 -07:00
9950060390 Update 2023-03-27 20:28:10 -07:00
9928fe3845 Update 2023-03-27 20:18:55 -07:00
f406c6308f Update 2023-03-27 00:46:51 -07:00
8fe7bb7a23 Update 2023-03-27 00:46:29 -07:00
07328f7c54 Update 2023-03-27 00:45:59 -07:00
7672c9d8b2 Update 2023-03-27 00:45:23 -07:00
7192e0492f Update 2023-03-27 00:44:58 -07:00
f42c958aae Update 2023-03-27 00:44:36 -07:00
d1a99675f8 Update 2023-03-27 00:42:45 -07:00
3c15661d5d Update 2023-03-27 00:42:19 -07:00
dec3e73214 Update 2023-03-27 00:40:41 -07:00
19364ce61a Update 2023-03-27 00:40:16 -07:00
5f33789321 Update 2023-03-27 00:39:49 -07:00
4910e1aa86 Update 2023-03-26 20:25:09 -07:00
406f3a51aa Update 2023-03-26 20:24:36 -07:00
df1af3af3d Update 2023-03-26 20:24:17 -07:00
1d09d82796 Update 2023-03-26 20:23:59 -07:00
b6640a1e65 Update 2023-03-26 20:23:21 -07:00
4e4e84721a Update 2023-03-26 20:23:00 -07:00
6313b67737 Update 2023-03-26 20:22:38 -07:00
7b2b1e4f99 Update 2023-03-26 20:22:13 -07:00
359dbd66e5 Update 2023-03-26 20:21:42 -07:00
e40e14b320 Update 2023-03-26 20:13:44 -07:00
1808c8e471 Update 2023-03-26 20:13:25 -07:00
98d3c5b485 Update 2023-03-26 20:13:05 -07:00
fcd2c623d4 Update 2023-03-26 20:12:37 -07:00
314ea00c0d Update 2023-03-26 20:12:16 -07:00
f68ebe8142 Update 2023-03-26 19:52:51 -07:00
8ba5f84507 Update 2023-03-26 19:52:04 -07:00
345d97d274 Update 2023-03-26 19:50:50 -07:00
0c27a5e1b7 Update 2023-03-26 19:49:44 -07:00
8ad17122c0 Update 2023-03-26 19:49:07 -07:00
8da6b9061b Update 2023-03-26 16:28:28 -07:00
60b2ba3967 Update 2023-03-26 16:28:11 -07:00
e67ae01999 Update 2023-03-26 16:27:42 -07:00
a841cbd2a0 Update 2023-03-26 16:27:23 -07:00
9faff22c99 Update 2023-03-26 16:27:04 -07:00
9c871d65b0 Update 2023-03-26 16:23:03 -07:00
42edd30055 Update 2023-03-26 16:22:32 -07:00
39d0944865 Update 2023-03-26 16:21:50 -07:00
0496bb883d Update 2023-03-26 16:17:25 -07:00
983f7e1cbf Update 2023-03-26 16:15:59 -07:00
f2db2563a9 Update 2023-03-26 16:14:54 -07:00
b66b608d6d Update 2023-03-26 16:14:33 -07:00
66132e3c56 Update 2023-03-26 16:10:13 -07:00
76447afbd3 Update 2023-03-26 16:09:36 -07:00
8818ff3336 Update 2023-03-26 16:09:15 -07:00
c62080a3be Update 2023-03-25 23:42:13 -07:00
564556eef5 Update 2023-03-25 23:41:56 -07:00
60a621be5e Update 2023-03-25 23:41:36 -07:00
48b8919c71 Update 2023-03-25 23:41:15 -07:00
d7ca9e82ca Update 2023-03-25 22:52:10 -07:00
89503eb540 Update 2023-03-25 22:52:00 -07:00
c4898dcdec Update 2023-03-25 22:51:37 -07:00
48135e7a8f Update 2023-03-25 22:51:18 -07:00
ac1482a04b Update 2023-03-25 22:51:02 -07:00
86331f9399 Update 2023-03-25 22:49:15 -07:00
c128a9616e Update 2023-03-25 22:48:55 -07:00
e760c27dd6 Update 2023-03-25 22:48:37 -07:00
b16bfcbf19 Update 2023-03-25 22:47:46 -07:00
8f7b3570c0 Update 2023-03-25 22:47:31 -07:00
15c9e7545d Update 2023-03-25 22:38:29 -07:00
41cf52baa1 Update 2023-03-25 21:11:54 -07:00
482c144487 Update 2023-03-25 21:11:26 -07:00
658d93319f Update 2023-03-25 21:11:03 -07:00
25be1a7767 Update 2023-03-25 21:10:31 -07:00
256a5ac7ab Update 2023-03-25 20:44:37 -07:00
6a3b4e3644 Update 2023-03-25 20:44:20 -07:00
fad7070941 Update 2023-03-25 20:43:58 -07:00
bddf5954a0 Update 2023-03-24 22:46:01 -07:00
3745adbec3 Update 2023-03-24 22:45:43 -07:00
662a46013f Update 2023-03-24 22:45:24 -07:00
65c3a2e2d6 Update 2023-03-24 22:45:04 -07:00
a76c4f7d89 Update 2023-03-24 22:44:44 -07:00
d07f31b91c Update 2023-03-24 22:44:21 -07:00
ee2f809aa5 Update 2023-03-24 22:44:02 -07:00
9ccf9b8051 Update 2023-03-24 22:43:42 -07:00
f410e0afc8 Update 2023-03-24 22:43:17 -07:00
dda0a106cb Update 2023-03-24 22:42:58 -07:00
da6b8de658 Update 2023-03-24 22:42:31 -07:00
ce6b7fcf92 Update 2023-03-24 22:41:53 -07:00
9fd642e74a Update 2023-03-24 22:38:47 -07:00
1f7121848e Update 2023-03-24 22:38:27 -07:00
61e70a7388 Update 2023-03-24 22:38:01 -07:00
2a5d5f660d Update 2023-03-24 22:37:25 -07:00
e449c59fcf Update 2023-03-24 22:37:09 -07:00
1f9647d42e Update 2023-03-24 22:36:49 -07:00
537289fec9 Update 2023-03-24 22:35:56 -07:00
9137c6f618 Update 2023-03-24 22:35:35 -07:00
78ba7e8fd0 Update 2023-03-24 22:35:16 -07:00
7603e2b590 Update 2023-03-24 22:34:33 -07:00
8467216a34 Update 2023-03-24 22:34:11 -07:00
7913130d95 Update 2023-03-24 22:33:51 -07:00
bff4ab9a3b Update 2023-03-24 22:33:34 -07:00
d570325d19 Update 2023-03-24 22:33:00 -07:00
c803a8dbae Update 2023-03-24 22:32:34 -07:00
74326c1142 Update 2023-03-24 22:32:10 -07:00
8567467034 Update 2023-03-24 22:31:48 -07:00
7d396a5e3b Update 2023-03-24 10:38:19 -07:00
12b6130fd8 Update 2023-03-24 10:37:02 -07:00
a24d2b79a2 Update 2023-03-24 10:36:39 -07:00
36932f17f1 Update 2023-03-24 10:35:50 -07:00
8902c291a0 Update 2023-03-24 10:35:28 -07:00
367d948398 Update 2023-03-24 10:34:33 -07:00
82dbe45f0a Update 2023-03-24 10:34:09 -07:00
ee9ce5976f Update 2023-03-24 10:33:47 -07:00
387b1a72c8 Update 2023-03-24 10:33:23 -07:00
75d4be394f Update 2023-03-24 10:32:59 -07:00
aa1a2a1586 Update 2023-03-24 10:32:37 -07:00
513e7fa605 Update 2023-03-24 04:00:27 -07:00
0b85e4912c Update 2023-03-24 03:59:59 -07:00
93a02dcef8 Update 2023-03-24 03:59:32 -07:00
27fcd45823 Update 2023-03-24 03:58:52 -07:00
d10ef24f28 Update 2023-03-24 03:58:10 -07:00
3d8c42f4cc Update 2023-03-24 03:57:27 -07:00
8e8a7b1db8 Update 2023-03-24 03:56:55 -07:00
32cfc28d7d Update 2023-03-24 03:56:30 -07:00
020ed2fad9 Update 2023-03-24 03:55:58 -07:00
a418d08d1a Update 2023-03-24 03:55:01 -07:00
00d6dee929 Bump golang.org/x/net from 0.0.0-20220909164309-bea034e7d591 to 0.7.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.0.0-20220909164309-bea034e7d591 to 0.7.0.
- [Release notes](https://github.com/golang/net/releases)
- [Commits](https://github.com/golang/net/commits/v0.7.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-25 02:09:19 +00:00
ed716f02a4 Merge pull request #263 from thesixonenine/master
Update README.md
2022-11-25 00:30:11 -08:00
c484bd53c2 Update README.md 2022-11-25 15:55:25 +08:00
d72334caef Update Hash 2022-10-31 15:53:54 -07:00
013f8ccf45 Update DFS 2022-10-31 15:53:04 -07:00
3fa07173eb Update BFS 2022-10-31 15:52:04 -07:00
3b6dca06a7 Update Bit Manipulation 2022-10-25 15:58:42 -07:00
b222b40d82 Update Binary Search 2022-10-25 15:57:46 -07:00
ef5a1c8b76 Update Backtracking.md 2022-10-25 15:56:49 -07:00
cfb95901e5 Update Array.md 2022-10-25 15:54:52 -07:00
0eadbdb762 Update 2022-10-18 15:50:28 -07:00
c2733004ca Update 2022-10-18 15:41:23 -07:00
4b1db8e83f Add solution 0028、2021 2022-10-18 15:37:49 -07:00
ea509d2442 Update 2022-10-18 14:54:40 -07:00
df993e3000 Update 2022-10-18 14:54:09 -07:00
cc94ec2c21 Update 2022-10-18 14:53:40 -07:00
6f779e539e Update 2022-10-18 14:53:01 -07:00
5362eafd73 Update 2022-10-18 14:52:04 -07:00
1938082ea0 Update 2022-10-18 14:51:25 -07:00
c0e45969ca Update 2022-10-18 14:50:48 -07:00
6e73059586 Update 2022-10-18 14:50:03 -07:00
2f3240b873 Update 2022-10-18 14:49:15 -07:00
0cdc940cd3 Update 2022-10-18 14:35:33 -07:00
814c3e9d73 Update 2022-10-18 14:34:56 -07:00
1bd44302ed Update 2022-10-18 14:33:56 -07:00
9570c85c70 Update 2022-10-18 14:33:16 -07:00
00fe80e4df Update 2022-10-18 14:32:07 -07:00
b31d862e43 Update 2022-10-18 14:31:24 -07:00
70f1551b17 Update 2022-10-18 14:30:34 -07:00
4e875c0acd Update 2022-10-18 14:30:06 -07:00
3fb8605421 Update 2022-10-18 14:29:39 -07:00
494cc3a9f7 Update 2022-10-18 14:29:01 -07:00
5449aa5f7e Update README 2022-10-18 14:28:24 -07:00
31e9beef72 Update README 2022-10-18 14:05:04 -07:00
c95fcf98e8 Update 2022-10-18 13:34:57 -07:00
29f32400a0 Update 2022-10-18 13:26:34 -07:00
83c9444ce8 Update 2022-10-18 13:25:56 -07:00
7b805025c9 Update 2022-10-18 13:23:37 -07:00
8a9818d923 Update 2022-10-18 12:53:47 -07:00
94163c16ca Update 2022-10-18 12:53:09 -07:00
3ecf0b6ff4 Update 2022-10-18 12:50:39 -07:00
02547f4804 Update 2022-10-18 12:49:17 -07:00
85d1850ed9 Update 2022-10-18 12:48:23 -07:00
c4be75766e Update 2022-10-18 12:47:46 -07:00
5566cbedcf Update 2022-10-18 12:47:10 -07:00
73036c3685 Update 2022-10-18 12:46:30 -07:00
b482473452 Update 2022-10-18 12:45:48 -07:00
ba075a6984 Update 2022-10-18 12:43:58 -07:00
bc33a2d322 Update 2022-10-18 12:40:27 -07:00
3c2f281d80 Update 2022-10-18 12:39:36 -07:00
c2f8e1d947 Update Array 2022-10-11 02:49:30 -07:00
46868745c1 Refresh README 2022-09-10 21:39:31 -07:00
a95639543c Fix illegal name 2022-09-10 21:16:26 -07:00
ce4286a51d Fix ctl module 2022-09-10 19:20:34 -07:00
3442d3a339 Fix go module dependence 2022-09-10 18:05:19 -07:00
9437625832 Add go module in root directory 2022-09-10 16:41:11 -07:00
e2a72e6212 Add template module 2022-09-10 16:35:04 -07:00
aa0e2c897b Add structures module 2022-09-10 16:31:01 -07:00
f0d16fe32f Change ctl module level 2022-09-10 16:17:43 -07:00
e3bb5aff34 Add go module 2022-09-10 15:50:43 -07:00
c5ed9a37e8 Add go module 2022-09-10 11:50:44 -07:00
a655d95eea Fix goreport bug 2022-09-10 10:38:39 -07:00
dff1d84e1e Up goreport score 2022-09-10 10:37:23 -07:00
e227edf55a Fix go report 2022-09-08 14:55:40 -07:00
2a40f7cefb Change path 2022-09-08 14:49:18 -07:00
35a447cad6 Change path 2022-09-08 14:48:34 -07:00
30065c4b70 Change path 2022-09-08 14:46:29 -07:00
b94bef3b14 Update mod 2022-09-08 14:44:35 -07:00
f9438b6c46 Merge pull request #254 from Don2025/master
Solved the issue #253
2022-09-07 12:07:29 -07:00
984772f724 Add solution 1293、2096 2022-09-06 19:23:35 -07:00
200b30895c Update 1293 solution 2022-09-06 15:59:27 -07:00
56d9c2ba75 Update 0561 solution 2022-09-06 13:14:05 -07:00
2dcb43efa1 Solved the issue #253 2022-09-05 12:41:28 +08:00
5ec282a5c7 Update 2022-08-30 17:28:25 -07:00
51f6f2933e Update 2022-08-30 17:27:38 -07:00
57544f8726 Update 2022-08-28 15:37:51 -07:00
68ee68d28f Update 2022-08-28 15:37:02 -07:00
5292b14fda Update 2022-08-28 15:35:58 -07:00
0188b02705 Update 2022-08-28 15:32:48 -07:00
47424f3384 Update 2022-08-28 15:26:01 -07:00
2289321610 Update 2022-08-28 15:24:18 -07:00
c114a326ac Update 2022-08-28 15:23:16 -07:00
92f0db7400 Update 2022-08-28 15:22:41 -07:00
c349d6cfaf Update 2022-08-18 14:45:40 -07:00
4f91c4bd6d Update 2022-08-18 14:44:47 -07:00
a2ac608eea Update 2022-08-13 19:02:05 -07:00
ee626f37b4 Update 2022-08-13 19:00:54 -07:00
2a1b7177be Update 2022-08-13 19:00:10 -07:00
2163be2faf Update 2022-08-13 18:59:18 -07:00
4decc5445c Update 2022-08-13 18:58:23 -07:00
5273aaee57 Update 2022-08-13 18:57:18 -07:00
4d869321a1 Update 2022-08-13 18:56:44 -07:00
da59bd6b3b Update 2022-08-13 18:56:04 -07:00
a7c216575f Update 2022-08-06 22:46:01 -07:00
621fc00dcd Update 2022-08-06 22:45:17 -07:00
9df639e4d1 Update 2022-08-06 22:44:36 -07:00
4a8f5bdb25 Update 2022-08-06 22:43:56 -07:00
f6d639b694 Update 2022-08-06 22:43:06 -07:00
26eecfb08c Update 2022-08-06 22:42:27 -07:00
715ab65012 Update 2022-08-06 22:41:49 -07:00
6c05203809 Add solution 1022 2022-08-06 22:40:51 -07:00
ccde9a0e2c Add solution 419 2022-08-06 22:39:58 -07:00
13943aeb59 Add solution 396 2022-08-06 22:38:31 -07:00
235adcb11d Update 215 solution 2022-08-06 22:37:16 -07:00
57f9fa97af Merge pull request #251 from Don2025/master
Leetcode419
2022-07-22 23:02:28 -07:00
c4ef088d7f Update README 2022-07-22 23:00:43 -07:00
b5081cff9d Update 2022-07-22 22:58:56 -07:00
98b537654f Update 2022-07-22 22:51:31 -07:00
5797f77011 Update 2022-07-22 22:47:40 -07:00
c76d68d21d Update 2022-07-22 22:45:28 -07:00
54b6152ea3 Update 2022-07-22 22:44:21 -07:00
bf4048d46a Update 2022-07-22 22:40:38 -07:00
23dd9892d3 Update 2022-07-22 22:30:39 -07:00
f6a2b87674 Update 2022-07-22 22:29:50 -07:00
8b219118ac Update 2022-07-22 22:24:51 -07:00
4fea0cb416 Update 2022-07-22 22:24:13 -07:00
1e94b3b2ee Update 2022-07-22 22:23:35 -07:00
56660e42f6 Update 2022-07-22 22:22:33 -07:00
d12d4225b9 Update 2022-07-22 22:21:56 -07:00
a160745e96 Update 2022-07-22 22:20:00 -07:00
271ac63c53 Update 2022-07-22 22:18:44 -07:00
c3c054f832 Update 2022-07-22 22:17:24 -07:00
ab775bdacb Update 2022-07-22 22:14:39 -07:00
4b746c2e7e Update 2022-07-22 22:13:58 -07:00
0d1da6ae31 Merge branch 'master' of github.com:halfrost/LeetCode-Go 2022-07-22 22:12:55 -07:00
b1af73340f Update 2022-07-22 21:36:20 -07:00
2e73dbad85 add: leetcode 396 readme 2022-07-06 15:14:28 +08:00
e85bad3027 add: leetcode 396 test 2022-07-06 15:14:10 +08:00
0ecc089e36 add: leetcode 396 solution 2022-07-06 15:13:53 +08:00
a7907ebcc2 add: leetcode 419 test 2022-07-02 13:45:13 +08:00
c217fa252c add: leetcode 419 solution 2022-07-02 13:45:04 +08:00
3f0ef3a415 add: leetcode 419 readme 2022-07-02 13:44:55 +08:00
b700ceafc1 Merge pull request #250 from Don2025/master
Leetcode1022
2022-06-30 16:57:32 -07:00
3cb37345b8 Update 1022. Sum of Root To Leaf Binary Numbers_test.go 2022-06-29 18:58:38 +08:00
8033b9055e add: leetcode 1022 test 2022-06-28 11:38:50 +08:00
8c353893f9 add: leetcode 1022 solution 2022-06-28 11:38:40 +08:00
24f56bc288 add: leetcode 1022 readme 2022-06-28 11:38:26 +08:00
1793f49397 Merge pull request #249 from Don2025/master
Fixed display problems of uint32 type during go test
2022-06-27 10:40:50 -07:00
6af31837d3 Fixed display problems of uint32 type during go test 2022-06-27 19:06:43 +08:00
34d86c6628 Update 2022-06-22 18:01:25 -07:00
1be6b990cc Update 2022-06-22 18:00:40 -07:00
4d17c06e61 Update 2022-06-22 17:59:09 -07:00
4ac8c07a23 Update 2022-06-22 17:58:13 -07:00
41d8cfdfa6 Update 2022-06-22 17:57:15 -07:00
afd978ad65 Update 2022-06-22 17:56:22 -07:00
aeef5439f4 Update 2022-06-22 17:54:56 -07:00
d0c38ea0d6 Update README 2022-06-22 17:53:42 -07:00
79387709eb Merge pull request #243 from StellarisW/master
fix bug: can't fork repo in windows
2022-06-21 17:02:24 -07:00
21a9b98a14 fix error 2022-06-17 18:47:40 +08:00
c8d650f39b Update 2022-06-07 14:42:58 -07:00
a850f0416b Update 2022-06-06 10:30:25 -07:00
433db8452a Update 2022-06-04 15:36:29 -07:00
a9bae7c776 Update 2022-06-03 12:12:23 -07:00
e14059cc40 Update 2022-06-03 12:11:56 -07:00
59a6ed04b5 Update 2022-06-03 12:11:11 -07:00
3d14e94113 Update 2022-06-03 12:10:44 -07:00
b4fa4ee93b Update 2022-06-03 12:10:14 -07:00
bfa7319cab Update README 2022-06-03 12:09:31 -07:00
a4573f5439 Update directory 2022-05-27 16:16:49 -07:00
0d50557121 Update directory 2022-05-27 16:12:52 -07:00
b744248882 Update directory 2022-05-27 16:09:52 -07:00
2473e3db76 Update directory 2022-05-27 16:09:11 -07:00
b954a17720 Update directory 2022-05-27 16:08:28 -07:00
f6fcb33e9d Update directory 2022-05-27 16:07:51 -07:00
c5fcd07f72 Update directory 2022-05-27 16:06:40 -07:00
6563b2d32a Update 2022-05-20 11:46:46 -07:00
510fe9af7e Update 2022-05-19 21:29:58 -07:00
0afe9d5ea9 Fix error 2022-05-18 14:43:13 -07:00
f932b3f897 Update README 2022-05-18 11:10:06 -07:00
e8f35496e4 Merge pull request #233 from novahe/fix/0529
fix/529: space complexity O(n)-> O(1)
2022-05-18 06:31:51 -07:00
96d1c46897 Update 2022-05-18 06:30:28 -07:00
d3e6d504d3 Merge pull request #232 from gostool/leetcode0504
Leetcode0504
2022-05-18 06:29:14 -07:00
582d28f383 Update 2022-05-18 06:28:38 -07:00
f8d2e25681 Merge pull request #234 from gostool/leetcode2043
Leetcode2043
2022-05-18 06:26:47 -07:00
2155b7e2cd Update 2022-05-18 06:26:28 -07:00
a328ec1724 Merge pull request #235 from gostool/leetcode2038
Leetcode2038
2022-05-18 06:24:40 -07:00
a76dcda2d7 Update 2022-05-18 06:24:10 -07:00
94c90621e2 Merge pull request #237 from gostool/leetcode2037
Leetcode2037
2022-05-18 06:22:16 -07:00
b6628caf08 Update 2022-05-18 06:06:33 -07:00
ba446ce792 Merge pull request #238 from gostool/leetcode0728
Leetcode0728
2022-05-17 20:47:26 -07:00
ddb7d405e3 Update 2022-05-16 17:01:03 -07:00
d7460199e7 Update 2022-05-15 14:18:10 -07:00
56e82a8a76 Update 2022-05-15 14:17:38 -07:00
91f22bb629 Update 2022-05-15 14:16:50 -07:00
00f08ee280 Update 2022-05-15 14:15:33 -07:00
de440ce31c Update 2022-05-15 14:14:42 -07:00
f4bf65c12e Update README 2022-05-06 21:12:32 -07:00
efb609d0bc Update 2022-05-05 00:00:45 -07:00
c90925cac1 Update 2022-05-04 23:59:37 -07:00
cf62e8d88c Update 2022-05-04 23:58:57 -07:00
0b541b8063 Update 2022-05-04 23:24:56 -07:00
e8245d256d Update 2022-05-04 23:23:56 -07:00
6713a1da43 Update 2022-05-04 23:23:17 -07:00
f6f387c4c9 Update 2022-05-04 23:22:42 -07:00
8d8825d5d7 Update 2022-05-04 23:22:15 -07:00
fdbb97c38a Update 2022-05-04 23:21:48 -07:00
aba0c0bb89 Update 2022-05-04 23:21:16 -07:00
ace60c7085 Update 2022-05-04 23:20:29 -07:00
0d49c4baa5 Update 2022-05-04 23:20:00 -07:00
eda0ca97df Update 2022-05-04 23:19:27 -07:00
6640124f1a Update 2022-05-04 23:18:33 -07:00
6721273fd6 Update 2022-05-04 23:17:59 -07:00
31309e5fc6 Update 2022-05-04 23:17:24 -07:00
c790e94057 Update 2022-05-04 23:16:27 -07:00
ce42db7424 Update 2022-05-04 23:15:16 -07:00
67b2a804ad Update README 2022-05-04 23:11:08 -07:00
85933aba97 Merge pull request #240 from halfrost/halfrost-patch-1
Create FUNDING.yml
2022-05-03 23:15:18 -07:00
74793b40ff Create FUNDING.yml 2022-05-03 23:15:10 -07:00
7ff53f5465 Update Math 2022-04-04 11:50:36 -07:00
3e11abb6b4 Update Linked List 2022-04-04 11:50:06 -07:00
cfac6e69e0 Update Hash Table 2022-04-04 11:49:05 -07:00
20ee68f12f Update DP 2022-04-04 11:48:29 -07:00
866b482a59 Update DFS 2022-04-04 11:47:31 -07:00
b9d8019153 Update BFS 2022-04-04 11:45:03 -07:00
346d231e95 Update Bits 2022-04-04 11:44:35 -07:00
eed2d828a0 Update Binary Search 2022-04-04 11:42:50 -07:00
7bcbb5a0e5 Update Binary 2022-04-04 11:40:17 -07:00
66e605b559 Update Backtracking 2022-04-04 11:37:55 -07:00
e2dbc6377a Update Array 2022-04-04 11:37:11 -07:00
4d68c22e37 Update README 2022-04-04 11:36:11 -07:00
2afd2968f0 add: leetcode 0728 readme 2022-03-31 14:16:45 +08:00
5dbf391639 add: leetcode 0728 test 2022-03-31 14:16:36 +08:00
4fdf83b522 add: leetcode 0728 solution 2022-03-31 14:16:28 +08:00
e76878e297 add: leetcode 2037 readme 2022-03-24 11:24:06 +08:00
2e1ab89380 add: leetcode 2037 test 2022-03-24 11:23:46 +08:00
e5bbc2ea75 add: leetcode 2037 solution 2022-03-24 11:23:37 +08:00
7f871503d6 add: leetcode 2038 readme 2022-03-22 10:57:48 +08:00
acf7a8fc97 add: leetcode 2038 test 2022-03-22 10:57:36 +08:00
1cfe12d6ca add: leetcode 2038 solution 2022-03-22 10:57:27 +08:00
e1d3d596fb Update 2022-03-19 23:04:29 -07:00
98dc4bddd4 Update 2022-03-19 23:03:05 -07:00
f6fe9d592d Update 2022-03-19 23:02:44 -07:00
3fb28d858e Update 2022-03-19 23:02:12 -07:00
92ec56c634 Update 2022-03-19 23:01:35 -07:00
85060a4085 Update README 2022-03-19 23:00:39 -07:00
2e392abddf Update model 2022-03-19 22:46:21 -07:00
e55c6597ac add: leetcode 2043 readme 2022-03-18 11:05:10 +08:00
025a7cb435 add: leetcode 2043 test 2022-03-18 11:04:53 +08:00
3581821e35 add: leetcode 2043 solution 2022-03-18 11:04:40 +08:00
31a02a5c40 fix/529: space complexity O(n)-> O(1) 2022-03-13 01:22:13 +08:00
0de6b2993b add: leetcode 0504 readme 2022-03-07 10:40:37 +08:00
dd97a844fe add: leetcode 0504 test 2022-03-07 10:40:24 +08:00
91f1797e86 add: leetcode 0504 solution 2022-03-07 10:40:15 +08:00
df751e8390 Update 2022-03-05 02:15:08 -08:00
645189643e Update 2022-03-05 02:13:29 -08:00
bc529924c3 Update solution 707、918 2022-03-01 22:38:23 -08:00
bc7f1d1120 Merge pull request #226 from kinsolee/master
fix 706:  bug with edge case
2022-03-01 20:56:27 -08:00
a3977996e9 Update solution 540 2022-03-01 20:55:43 -08:00
3df9ef465d Merge pull request #227 from gostool/leetcode0540
Leetcode0540
2022-03-01 20:43:51 -08:00
454b3a9190 update solution 1984 2022-03-01 20:37:59 -08:00
39360aeb23 Merge pull request #228 from gostool/leetcode1984
Leetcode1984
2022-03-01 19:39:36 -08:00
a8993ba374 update solution 1791 2022-03-01 19:33:47 -08:00
a50453260d Merge pull request #229 from gostool/leetcode1791
Leetcode1791
2022-03-01 19:28:44 -08:00
2c04339ee2 fix solution 2022 2022-03-01 19:04:59 -08:00
7ca23a6cf6 Merge pull request #231 from coder-xiaomo/patch-2
Update Time_Complexity.md
2022-03-01 19:02:25 -08:00
4697dfedeb fix solution 2183 2022-03-01 10:43:30 -08:00
14f73a9c23 fix solution 2167 2022-03-01 03:46:51 -08:00
5d7c0f4d79 Add solution 560、1763、2164、2165、2166、2167、2169、2170、2171、2180、2181、2182、2183、 2022-03-01 03:28:45 -08:00
deed0a67a0 Update 2022-03-01 03:04:58 -08:00
d2333f8ebb Update 2022-03-01 03:03:38 -08:00
358768df9d Update 2022-03-01 03:02:48 -08:00
9950fd97c5 Update 2022-03-01 03:01:58 -08:00
ab4bdb0271 Update 2022-03-01 01:53:32 -08:00
5ec0ac8874 Update 2022-03-01 01:53:00 -08:00
b630fcb826 Update 2022-03-01 01:51:42 -08:00
7dcd5c74c1 Update Time_Complexity.md
修改了一些细节方面的问题,比如else拼写错啦,然后函数掉了一个反括号等等
2022-02-22 15:06:24 +08:00
f2402ff813 Update 2022-02-21 04:19:22 -08:00
e3a92f05c2 Update 2022-02-21 04:18:41 -08:00
3736e7d858 Update 2022-02-21 04:17:43 -08:00
f9adc703dc add: leetcode 1791 readme 2022-02-18 11:30:16 +08:00
671f325f14 add: leetcode 1791 test 2022-02-18 11:30:05 +08:00
5df12ecbc2 add: leetcode 1791 solution 2022-02-18 11:29:55 +08:00
2634cefe44 Update 2022-02-15 01:35:00 -08:00
88a9c95a03 Update 2022-02-15 01:34:07 -08:00
3c60ddec08 Update 2022-02-15 01:33:20 -08:00
c1b9daea5b add: leetcode 1984 readme 2022-02-15 12:13:10 +08:00
9baf420781 add: leetcode 1984 test 2022-02-15 12:12:57 +08:00
e95fd4b48f add: leetcode 1984 solution 2022-02-15 12:12:50 +08:00
babbfc7221 add: leetcode 540 readme 2022-02-14 11:32:39 +08:00
eb409d4936 add: leetcode 540 test 2022-02-14 11:32:13 +08:00
a9be8a0e35 add: leetcode 540 solution 2022-02-14 11:32:05 +08:00
e909b40f5c Update 2022-02-10 23:06:41 -08:00
060672346e Update 2022-02-09 22:36:27 -08:00
6abf8f9108 Update 2022-02-09 22:35:42 -08:00
4321362cf8 Update 2022-02-09 22:35:06 -08:00
09d51fd394 fix 706: bug with edge case 2022-02-08 22:03:54 +08:00
1e0a830c33 Update 2022-02-03 01:34:39 -08:00
ccc22d8237 Add solution 2022 2022-02-03 01:34:08 -08:00
a6744f809c Add solution 1705 2022-02-03 01:33:05 -08:00
31dd61ffcf Add solution 1609 2022-02-03 01:32:30 -08:00
2edc808012 Add solution 1576 2022-02-03 01:32:03 -08:00
f1851ade02 Add solution 1296 2022-02-03 01:31:36 -08:00
65553627c8 Add solution 1009/1010 2022-02-03 01:29:05 -08:00
f41d1df6d7 Add solution 846 2022-02-03 01:28:30 -08:00
a8dac4007e Add solution 825 2022-02-03 01:27:56 -08:00
9e186518c6 Add solution 747 2022-02-03 01:27:14 -08:00
ac7a582c74 Update 2022-02-03 01:26:39 -08:00
5bf058e323 Add solution 701 2022-02-03 01:20:53 -08:00
67f4538b54 Update 2022-02-03 01:19:58 -08:00
2e2934db95 Add solution 390 2022-02-03 01:17:22 -08:00
e3100de700 Add solution 382 2022-02-03 00:59:58 -08:00
0b300475d9 Update 2022-02-03 00:58:59 -08:00
481e6824f3 Update 2022-02-03 00:55:30 -08:00
eb13b52f45 Update 2022-02-03 00:54:48 -08:00
9874368b78 Update solution 1705 2022-02-02 15:23:35 -08:00
ced7434c34 Merge pull request #218 from gostool/leetcode1705
Leetcode1705
2022-02-02 15:22:11 -08:00
5ea6d39184 Update solution 1609 2022-02-02 15:21:18 -08:00
ca2bc23e8d Merge pull request #219 from gostool/leetcode1609
Leetcode1609
2022-02-02 15:19:16 -08:00
32fe3e22c9 Update 846 solution 2022-02-02 15:18:29 -08:00
3e60f0b19b Merge pull request #220 from gostool/leetcode0846
Leetcode0846
2022-02-02 15:14:38 -08:00
bf40f42476 Update solution 3 2022-01-16 17:54:52 -08:00
4c3088b02a update 2022-01-14 23:46:38 -08:00
97312873b2 Merge pull request #222 from gostool/leetcode1296
Leetcode1296
2022-01-14 21:23:00 -08:00
8031908a03 Merge pull request #223 from zzzkl/patch-1
Update 0005.Longest-Palindromic-Substring.md
2022-01-14 20:03:05 -08:00
959e309ff2 Add solution 747 2022-01-12 23:49:15 -08:00
172d2fc0ae Add solution 701 2022-01-12 01:52:06 -08:00
5e2df33c54 Add solution 2022-01-10 22:56:30 -08:00
50184579f5 Add solution 2022-01-10 18:50:17 -08:00
d6bf226b2f Add solution 825 2022-01-10 18:39:12 -08:00
796cccce30 Add solution 0382 2022-01-08 01:15:30 -08:00
61d7c48523 Add solution 1576 2022-01-06 03:17:05 -08:00
9e302d2924 Add solution 390 2022-01-06 01:22:12 -08:00
5b5bbb2ebe Add solution 1009 2022-01-05 21:45:59 -08:00
32a5c605c6 Add solution 1010 2022-01-05 17:41:54 -08:00
78bcffd3e4 Update 0005.Longest-Palindromic-Substring.md 2022-01-04 09:36:29 +08:00
2a94da0c1d Add solution 2022 2022-01-03 14:32:52 -08:00
3335503ec0 add: leetcode 1296 readme 2022-01-01 22:08:33 +08:00
e24018c77b add: leetcode 1296 test 2022-01-01 22:08:20 +08:00
2f6128ce26 add: leetcode 1296 solution 2022-01-01 22:08:09 +08:00
e81b962f05 add: leetcode 0846 readme 2021-12-31 18:02:09 +08:00
079792b89a add: leetcode 0846 test 2021-12-31 18:01:57 +08:00
fe6a721e36 add: leetcode 0846 solution 2021-12-31 18:01:48 +08:00
f8b38b73bb add: leetcode 1609 readme 2021-12-27 20:21:41 +08:00
e81f874c80 add: leetcode 1609 test 2021-12-27 20:21:24 +08:00
8ca4bcf4d1 add: leetcode 1609 solution 2021-12-27 20:21:09 +08:00
1a959a2ace Update 2021-12-24 15:35:29 -08:00
ce705121e9 add: leetcode 1705 readme 2021-12-24 17:00:12 +08:00
9beb4a8ad0 add: leetcode 1705 test 2021-12-24 16:59:44 +08:00
77dd8cf056 add: leetcode 1705 solution 2021-12-24 16:59:29 +08:00
296c2b6e5c Update 0014 solution 2021-12-22 21:27:49 -08:00
90ee2871be Merge pull request #217 from brenobaptista/update-14
Update problem #14
2021-12-22 21:26:23 -08:00
0468622cc6 Update 997 solution 2021-12-22 21:24:43 -08:00
1499e7804c Merge pull request #216 from gostool/leetcode0997
Leetcode0997
2021-12-22 21:20:19 -08:00
a5d665ce01 Update 807 solution 2021-12-22 21:20:00 -08:00
fc8c6a546e Merge pull request #213 from gostool/leetcode0807
Leetcode0807
2021-12-22 21:16:15 -08:00
577d3d465f Update 1518 solution 2021-12-22 21:15:09 -08:00
c99d3ef68f Merge pull request #214 from gostool/leetcode1518
Leetcode1518
2021-12-22 21:10:50 -08:00
7930b8dbf7 Update 794 solution 2021-12-22 21:09:05 -08:00
f6f2eeb119 Merge pull request #212 from gostool/leetcode0794
Leetcode0794
2021-12-22 20:55:49 -08:00
eaeed30931 Merge pull request #211 from gostool/leetcode1034
Leetcode1034
2021-12-22 20:54:08 -08:00
9d0be98918 Merge pull request #208 from fecqs/patch-1
Update 0283.Move-Zeroes.md
2021-12-22 20:41:11 -08:00
d845577eac Update 1816 solution 2021-12-22 20:39:56 -08:00
b1ddc35006 Merge pull request #209 from gostool/leetcode1816
Leetcode1816
2021-12-22 20:26:29 -08:00
7d760f1091 Update 383 solution 2021-12-22 20:23:46 -08:00
481b1ddfa1 Merge pull request #207 from gostool/leetcode0383
Leetcode0383
2021-12-22 20:21:55 -08:00
75074a73d0 Update 506 solution 2021-12-22 20:10:48 -08:00
a8c69e5520 Merge pull request #205 from gostool/leetcode0506
Leetcode0506
2021-12-22 20:07:20 -08:00
d40d0e770b Merge pull request #206 from novahe/fix/1019
fix 1019: update solution
2021-12-22 19:45:05 -08:00
e4ea6b83a6 Update 1446 solution 2021-12-22 19:43:05 -08:00
4f120e3c23 Merge pull request #204 from gostool/leetcode1446
Leetcode1446
2021-12-22 19:17:11 -08:00
5c81c0982f Update 400 solution 2021-12-22 19:15:51 -08:00
89b3eb3b53 Merge pull request #203 from gostool/leetcode0400
Leetcode0400
2021-12-22 19:08:01 -08:00
6a96686263 Update 159 solution 2021-12-22 19:04:22 -08:00
7788ab94c8 Merge pull request #202 from gostool/leetcode0519
Leetcode0519
2021-12-22 13:02:19 -08:00
5b30c29424 Merge pull request #201 from novahe/master
update/0987: clean up redundant code
2021-12-22 12:47:51 -08:00
24a8bbfa66 Added one more test case 2021-12-20 20:48:19 -03:00
2bd5b2ef93 Updated README 2021-12-20 20:48:09 -03:00
b5dce1a2f0 Added solution without importing sort 2021-12-20 20:47:59 -03:00
4b6a883ed9 add: leetcode 0997 readme 2021-12-20 11:04:39 +08:00
c9dcb46dc8 add: leetcode 0997 test 2021-12-20 11:04:14 +08:00
f4aa4ac70e add: leetcode 0997 solution 2021-12-20 11:04:02 +08:00
70740cc973 add: leetcode 1518 readme 2021-12-17 16:23:24 +08:00
7e9d5af03c add: leetcode 1518 test 2021-12-17 16:22:52 +08:00
a3328f0d7f add: leetcode 1518 solution 2021-12-17 16:22:12 +08:00
fb357810cb add: leetcode 0794 readme 2021-12-17 16:14:56 +08:00
30871db28e add: leetcode 0794 test 2021-12-17 16:14:19 +08:00
b4e77f1457 add: leetcode 0794 solution 2021-12-17 16:13:11 +08:00
e3bde6844b update: var name & make 2021-12-17 11:44:58 +08:00
ce7c41b9c4 add: leetcode 0807 readme 2021-12-17 11:44:38 +08:00
a9be35d9ab add: leetcode 0807 test 2021-12-17 11:43:37 +08:00
7c0d8438b0 add: leetcode 0807 solution 2021-12-17 11:41:56 +08:00
94c703c2d5 update: leetcode 1034 solution && readme 2021-12-09 12:53:23 +08:00
bda9f48034 add: leetcode 1034 readme 2021-12-07 17:13:34 +08:00
789c49065c add: leetcode 1034 test 2021-12-07 17:13:19 +08:00
f51fdcfe2b add: leetcode 1034 solution 2021-12-07 17:13:10 +08:00
a3c7d4247c fix ctl model type 2021-12-06 11:26:37 -08:00
7e4a6e9919 add: leetcode 1816 readme 2021-12-06 11:09:47 +08:00
cfb12662f3 add: leetcode 1816 test 2021-12-06 11:09:34 +08:00
5bfcf3f0c1 add: leetcode 1816 solution 2021-12-06 11:09:24 +08:00
7994594595 Update 0283.Move-Zeroes.md
else {j++} seems to be omitted
2021-12-04 11:33:17 +08:00
6cb7b1ab5e add: leetcode 0383 readme 2021-12-04 11:01:42 +08:00
0f77021c94 add: leetcode 0383 test 2021-12-04 11:01:28 +08:00
4658dd7813 add: leetcode 0383 solution 2021-12-04 11:01:18 +08:00
f49a36789f fix 1019: update solution 2021-12-02 15:09:15 +08:00
752256a703 add: leetcode 0506 readme 2021-12-02 09:58:29 +08:00
1fa8edd360 add: leetcode 0506 test 2021-12-02 09:58:16 +08:00
257b503f8a add: leetcode 0506 solution 2021-12-02 09:58:05 +08:00
f0f1f7f33e add: leetcode 1446 readme 2021-12-01 10:45:32 +08:00
597779ee83 add: leetcode 1446 test 2021-12-01 10:45:15 +08:00
84730fa795 add: leetcode 1446 solution 2021-12-01 10:44:57 +08:00
6b6942cdbe add: leetcode 0400 readme 2021-11-30 16:24:08 +08:00
adfdee1ef7 add: leetcode 0400 test 2021-11-30 16:23:55 +08:00
a7a4e6dbed add: leetcode 0400 solution 2021-11-30 16:23:45 +08:00
51ecdf3b86 add: leetcode 0519 readme 2021-11-29 18:30:46 +08:00
a8e452df58 add: leetcode 0519 test 2021-11-29 18:30:32 +08:00
2da2dc4732 add: leetcode 0519 solution 2021-11-29 18:30:22 +08:00
6165466253 Merge branch 'master' of https://github.com/halfrost/LeetCode-Go 2021-11-28 21:57:43 +08:00
e4458749e6 update/0987: clean up redundant code 2021-11-28 21:56:14 +08:00
a45992e7de Update README 2021-11-26 05:27:50 -08:00
8ff3546b5d Update solution 0700 2021-11-26 05:21:49 -08:00
a7ce19c62e Merge pull request #199 from gostool/leetcode0700
Leetcode0700
2021-11-26 05:18:54 -08:00
c46ebd12b1 Update solution 458 2021-11-26 05:18:35 -08:00
33ab545711 Merge pull request #198 from gostool/leetcode0458
Leetcode0458
2021-11-26 05:15:37 -08:00
b411d6f974 Merge pull request #196 from novahe/master
fix 0978: update a clearer solution
2021-11-26 00:12:00 -08:00
19187ae7be Update solution 0859 2021-11-26 00:06:25 -08:00
21e84f16eb Merge pull request #195 from gostool/leetcode0859
Leetcode0859
2021-11-26 00:00:00 -08:00
cb9ecdcf11 Update solution 384 2021-11-25 23:59:15 -08:00
0552c4510c Merge pull request #194 from gostool/leetcode0384
Leetcode0384
2021-11-25 23:57:29 -08:00
6f4e1b45fb Update solution 0559 2021-11-25 23:56:46 -08:00
535fc1736a Merge pull request #193 from gostool/leetcode0559
Leetcode0559
2021-11-25 23:54:18 -08:00
f2efd77482 Update solution 0014 2021-11-25 23:52:44 -08:00
b31ab42399 Merge branch 'master' of github.com:halfrost/LeetCode-Go 2021-11-25 23:51:38 -08:00
a2b23a3292 Merge pull request #192 from gostool/leetcode0014
Leetcode0014
2021-11-25 23:51:02 -08:00
7c80298814 Merge pull request #192 from gostool/leetcode0014
Leetcode0014
2021-11-25 23:42:17 -08:00
0495d2b0ff Update solution 0391 2021-11-25 23:36:14 -08:00
fd41bd923c Merge pull request #191 from gostool/leetcode0391
Leetcode0391
2021-11-25 23:33:23 -08:00
1bce2a9193 Update solution 0319 2021-11-25 23:32:07 -08:00
f6f37533b1 Merge pull request #190 from gostool/leetcode0319
Leetcode0319
2021-11-25 23:27:22 -08:00
1bef7668fc add: leetcode 0700 readme 2021-11-26 11:18:26 +08:00
c5fef19d6a add: leetcode 0700 test 2021-11-26 11:18:12 +08:00
6ecc8bf8e7 add: leetcode 0700 solution 2021-11-26 11:18:00 +08:00
14f2bde839 add: leetcode 0458 readme 2021-11-25 11:55:36 +08:00
c8c644fd96 add: leetcode 0458 test 2021-11-25 11:55:22 +08:00
04ead8d3f3 add: leetcode 0458 solution 2021-11-25 11:55:09 +08:00
9cc8c478b9 fix 0978: update a clearer solution 2021-11-24 10:33:13 +08:00
0a27b2bd28 add: leetcode 0859 readme 2021-11-23 10:44:49 +08:00
3d044414a2 add: leetcode 0859 test 2021-11-23 10:44:37 +08:00
36f13cef14 add: leetcode 0859 solution 2021-11-23 10:44:27 +08:00
79079c6a08 add: leetcode 0384 readme 2021-11-22 16:51:10 +08:00
f8a3773911 add: leetcode 0384 test 2021-11-22 16:50:55 +08:00
469e775a97 add: leetcode 0384 solution 2021-11-22 16:50:43 +08:00
2163cb1657 add: leetcode 0559 readme 2021-11-21 12:05:20 +08:00
3e31bbd244 add: leetcode 0559 test 2021-11-21 12:05:08 +08:00
d4704811b9 add: leetcode 0559 solution 2021-11-21 12:01:24 +08:00
1ba28c5bbf add: leetcode 0014 readme 2021-11-19 10:33:14 +08:00
179ac20a83 add: leetcode 0014 test 2021-11-19 10:33:00 +08:00
8583203e26 add: leetcode 0014 solution 2021-11-19 10:32:49 +08:00
6df33967bd add: leetcode 0391 readme 2021-11-16 12:12:42 +08:00
1843c18959 add: leetcode 0391 test 2021-11-16 12:12:22 +08:00
df536787f0 add: leetcode 0391 solution 2021-11-16 12:12:07 +08:00
006fadc53b add: leetcode 0319 readme 2021-11-15 11:42:43 +08:00
4fda03d823 add: leetcode 0319 test 2021-11-15 11:42:30 +08:00
bda179b761 add: leetcode 0319 solution 2021-11-15 11:42:20 +08:00
f0792d1179 Update solution 0520 2021-11-13 21:13:27 -08:00
8f64507c9c Merge pull request #188 from gostool/leetcode0520
Leetcode0520
2021-11-13 21:07:38 -08:00
d9a9759a11 Add solution 0494 2021-11-13 21:06:59 -08:00
3024684bf1 Merge pull request #187 from gostool/leetcode0495
Leetcode0495
2021-11-13 21:00:11 -08:00
79a5d9eba5 Add solution 1178 2021-11-13 20:59:34 -08:00
ef2f198bd3 Merge pull request #186 from dotcom900825/patch-2
Minor type fix 1178.Number-of-Valid-Words-for-Each-Puzzle.md
2021-11-13 20:44:16 -08:00
04eae300bc Add solution 0488 2021-11-13 20:41:51 -08:00
d0aa4565cc Merge pull request #185 from gostool/leetcode0488
Leetcode0488
2021-11-13 20:30:19 -08:00
6fac7d3f8c Add solution 0299 2021-11-13 20:29:11 -08:00
a47ce19ef2 Merge branch 'master' of github.com:halfrost/LeetCode-Go 2021-11-13 20:24:56 -08:00
72dc8a52e6 Merge pull request #184 from gostool/leetcode0299
Leetcode0299
2021-11-13 20:24:26 -08:00
fdb35af2a8 Merge pull request #184 from gostool/leetcode0299
Leetcode0299
2021-11-13 20:16:18 -08:00
0ef19c8e0b add: leetcode 0520 readme 2021-11-13 20:45:23 +08:00
75d1e15eef add: leetcode 0520 test 2021-11-13 20:44:54 +08:00
761469af16 add: leetcode 0520 solution 2021-11-13 20:44:39 +08:00
a2859d0359 add: leetcode 0495 readme 2021-11-10 14:46:35 +08:00
ed4cc45b44 add: leetcode 0495 test 2021-11-10 14:46:20 +08:00
d7f2304e19 add: leetcode 0495 solution 2021-11-10 14:46:00 +08:00
f40d668652 Update 1178.Number-of-Valid-Words-for-Each-Puzzle.md 2021-11-09 00:33:18 -08:00
81f38f90c3 add: leetcode 0488 readme 2021-11-09 16:21:56 +08:00
2a5d87d32e add: leetcode 0488 test 2021-11-09 16:21:25 +08:00
255faef838 add: leetcode 0488 solution 2021-11-09 16:21:11 +08:00
8ae68c0652 update: README.md 2021-11-08 17:01:43 +08:00
e6fd62785f add: leetcode 0299 solution 2021-11-08 16:59:23 +08:00
df54373ba8 Update solution 0541 2021-11-07 01:15:26 -08:00
fcc3d10ff1 update solution 0031 & 0048 2021-11-06 20:56:12 -07:00
20ae5d88ba Merge pull request #180 from ashtishad/master
Update 031-Next Permutation and 048. Rotate Image
2021-11-06 19:28:11 -07:00
b3225a0f11 Add solution 492 2021-11-06 19:18:25 -07:00
f09ea6cd09 Update README 2021-11-06 19:06:10 -07:00
7d3ba345f3 Merge pull request #176 from gostool/leetcode0301
add: leetcode 0301 solution
2021-11-06 18:42:02 -07:00
a3f71751eb Merge pull request #181 from novahe/master
update/0515: add other solution
2021-11-06 18:28:03 -07:00
2051a1b67c Merge pull request #182 from dotcom900825/patch-1
Minor typo fix
2021-11-06 18:26:51 -07:00
0a3c4d0ed8 Minor type fix 2021-11-06 09:34:41 -07:00
2608238acb update/0515: add other solution 2021-11-05 19:45:18 +08:00
e6938093ca Update 48. Rotate Image
Notes:
----------
* easily understandable logic.
* rotate clock-wise = 1. transpose matrix => 2. reverse(matrix[i])
* detailed explanation in comment.
* passes all testcases.

Time Complexity  : O(N)
Space Complexity : O(1)
2021-11-04 15:37:15 +06:00
86b2646ec6 Update 031-Next Permutation
Changes:
----------
* Devided resposiblity with using functions.
* Slice in already a reference type in go, means in passes actual slice(not a copy) to functions, that's why using pointers in swap and reverse functions look redundant in my opinion.

Discussion:
--------------
https://leetcode.com/problems/next-permutation/discuss/1554932/Go-Submission-with-Explanation
2021-11-04 15:16:54 +06:00
7d08f48786 add: leetcode 0301 solution 2021-10-27 12:36:07 +08:00
af654b2e51 Update Chapter Two 2021-10-21 22:52:55 -07:00
796b4b6582 Update Chapter Two 2021-10-21 22:51:12 -07:00
9effade48f Update 0352 solution 2021-10-21 22:48:09 -07:00
44541dc0ef Merge pull request #173 from gostool/leetcode0352
add: leetcode 0352 solution
2021-10-21 22:17:51 -07:00
f68bec22d9 add: leetcode 0352 solution 2021-10-09 11:56:13 +08:00
0e69148802 Update 498 solution 2021-10-08 20:05:23 -07:00
819145dca6 Update 2021-10-08 20:02:46 -07:00
4b3ef8a97d Update 2021-10-08 20:02:14 -07:00
24ee84feaf Update 2021-10-08 20:01:23 -07:00
d3bb8b6279 Update 2021-10-08 20:00:27 -07:00
219c53bb03 Update 434 solution 2021-10-08 19:58:15 -07:00
16b1ab75bd Merge pull request #172 from gostool/leetcode0434
add: leetcode 0434 solution
2021-10-08 19:52:02 -07:00
325e5130b7 Update 212 solution 2021-10-08 19:50:33 -07:00
bde069b75e add: leetcode 0434 solution 2021-10-07 19:28:26 +08:00
f461eadb78 Update solution 0328 2021-09-17 23:41:06 -07:00
d32347137a Update solution 0058、0551、0958 2021-09-15 03:51:40 -07:00
71b771dc5d Add solution 0058 2021-09-15 03:22:09 -07:00
0d3b70571a Merge pull request #170 from gostool/leetcode0058
add: leetcode 0058 solution
2021-09-15 03:19:21 -07:00
bef7599068 Add solution 0551 2021-09-15 03:18:02 -07:00
3c11d93a29 add: leetcode 0058 solution 2021-09-15 17:04:01 +08:00
29880358f0 Merge pull request #166 from gostool/leetcode0551
add: leetcode 0551 solution
2021-09-14 23:49:07 -07:00
7db2a76fd6 Update solution 0445 2021-09-14 23:47:56 -07:00
5c0f4f9103 Merge pull request #167 from novahe/master
fix/445: add other solutions
2021-09-14 21:36:40 -07:00
3c85ef6e7a Update solution 0958 2021-09-14 21:25:13 -07:00
a2dcc00524 Update 2021-09-14 20:54:14 -07:00
f793b7aa48 Update 2021-09-14 20:49:29 -07:00
81d298f55c Update 2021-09-14 20:44:46 -07:00
07034111d5 Update 2021-09-14 20:40:50 -07:00
7acf5110db Update 2021-09-14 20:35:23 -07:00
50f90ec045 Update 2021-09-14 20:34:02 -07:00
1c71c1f0a5 Update 2021-09-14 20:33:19 -07:00
eec96cae11 Update 2021-09-14 20:32:12 -07:00
59c4b30d23 Update 2021-09-14 20:26:55 -07:00
c551601a99 Add solution 0958 2021-09-14 15:45:10 -07:00
086c7c9eda Merge pull request #168 from 3inchtime/958
add solution - 958
2021-09-14 15:37:16 -07:00
2e628eb33d Merge pull request #169 from zhufenggood/master
Update solution 0494.   Considering new edge test case.
2021-09-14 15:32:05 -07:00
a3f55d9560 Update solution 0494. Considering new edge test case. 2021-09-03 16:46:46 +08:00
e89003a2e3 Update solution 0494. Considering new edge test case. 2021-09-02 18:01:03 +08:00
61a586e96a Update solution 0494. Considering new edge test case. 2021-09-02 17:46:17 +08:00
e6bce61e81 add solution - 958 2021-08-30 23:22:14 +08:00
d1a87f1cbf fix/445: add other solution 2021-08-21 00:39:53 +08:00
5e49c8db0c Merge branch 'master' of https://github.com/halfrost/LeetCode-Go 2021-08-21 00:32:45 +08:00
daa7c7f044 fix/445: add other solution 2021-08-21 00:31:31 +08:00
d0f54e2bbd add: leetcode 0551 solution 2021-08-17 17:30:59 +08:00
2189396c54 Add solution 0677 2021-08-14 10:16:17 +08:00
4268f5837b Add solution 0429 2021-08-08 22:44:30 +08:00
a43125dc18 Add solution 1877 2021-08-08 20:33:36 +08:00
35530a4de4 Update solution 0116 2021-08-07 11:18:57 +08:00
d1e24bf344 Merge pull request #165 from 3inchtime/116
add 116 solution
2021-08-07 10:59:49 +08:00
6e74af9d6c Update solution 0106 2021-08-07 10:57:03 +08:00
33f616c7dc Merge pull request #163 from karminski/patch-2
Update 0106.Construct-Binary-Tree-from-Inorder-and-Postorder-Traversa…
2021-08-07 10:49:18 +08:00
c1d27a197b Update solution 0105 2021-08-07 10:48:43 +08:00
3de30e7848 Merge pull request #162 from karminski/patch-1
Update 0105.Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal.md
2021-08-07 10:28:27 +08:00
e4505aab14 Update solution 1104 2021-08-07 10:27:48 +08:00
78f8879463 Merge pull request #161 from gostool/leetcode1104
add: leetcode 1104 solution
2021-08-07 10:12:52 +08:00
3755d3f251 Update solution 0018 2021-08-07 10:11:27 +08:00
ae5c145c3f Update solution 0016 2021-08-07 09:58:49 +08:00
07ddc128b4 Update solution 1877 2021-08-07 09:01:39 +08:00
674e50ba0d update solution 1877 2021-08-07 08:54:30 +08:00
2f2ba72e92 Update solution 0242 2021-08-07 08:49:07 +08:00
0547b8b075 Merge pull request #160 from brenobaptista/suggestion-242
Suggestion 242
2021-08-07 08:37:38 +08:00
040ac16526 Update solution 0543 2021-08-07 08:36:35 +08:00
1c662f4330 Merge pull request #159 from brenobaptista/solution-543
Added solution 543
2021-08-07 08:00:45 +08:00
765bb777e3 Update solution 0141 2021-08-07 07:23:55 +08:00
23beddc2b1 Merge pull request #157 from brenobaptista/cleaned-141
Cleaned 141
2021-08-06 21:49:24 +08:00
7b7a39291a add 116 solution 2021-08-05 23:34:31 +08:00
21e5e780cc Update 0106.Construct-Binary-Tree-from-Inorder-and-Postorder-Traversal.md
UPDATE a new answer for less memory cost & FIX method name typo.
2021-07-30 00:18:32 +08:00
97928e7abe Update 0105.Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal.md
update a new answer for less memory cost.
2021-07-29 23:11:38 +08:00
28add7d729 add: leetcode 1104 solution 2021-07-29 11:58:29 +08:00
0823979d78 Suggestion for problem 242 2021-07-20 01:06:47 -03:00
c7d4051054 Added more tests 2021-07-20 01:05:56 -03:00
8b41ad38d3 Added English README 2021-07-19 22:42:27 -03:00
8c1235bdf1 Added tests for problem 543 2021-07-19 22:42:11 -03:00
dd26b1df3e Added solution 543 2021-07-19 22:41:51 -03:00
YDZ
02999e422e Update solution 1818 2021-07-19 04:12:39 +08:00
YDZ
82b544c664 Add solution 1818 2021-07-19 04:09:10 +08:00
YDZ
443b7ce63d Add solution 0611 2021-07-18 20:19:17 +08:00
YDZ
eda4953c3d Add solution 0791 2021-07-18 18:13:55 +08:00
YDZ
41b03831b3 Add solution 1846 2021-07-18 16:32:43 +08:00
da7f306dcb Added tests 2021-07-17 00:46:00 -03:00
c8aa2a477e Fixed definition 2021-07-17 00:36:07 -03:00
f5716a22aa Removed unnecessary condition 2021-07-17 00:32:50 -03:00
YDZ
185b1e1c3b Update 2021-07-11 18:59:30 +08:00
YDZ
c39400373d Update 2021-07-11 18:46:27 +08:00
YDZ
e04b83ff2c update solution 1006 2021-07-11 18:44:54 +08:00
YDZ
992ccf0054 Update 2021-07-03 21:33:49 +08:00
YDZ
cb6023e722 Update 2021-07-03 21:28:47 +08:00
YDZ
4af8e959b6 Update 2021-07-03 21:05:38 +08:00
YDZ
04679fe8bc Update solution 0168 2021-06-29 07:41:12 +08:00
YDZ
7a3db717e0 Update solution 0494 2021-06-28 16:42:33 +08:00
YDZ
38ffcbc1af Add solution 0135 2021-06-28 07:18:24 +08:00
YDZ
d5c5284b1a Update solution 0617 & Add solution 0752 2021-06-27 08:47:05 +08:00
bc7c912aa9 Merge pull request #155 from brenobaptista/solution-617
Added solution 617
2021-06-27 08:13:45 +08:00
YDZ
dbf56b5db8 Add solution 0909 2021-06-27 08:12:29 +08:00
127b852d7d Update solution 0234 2021-06-26 18:30:54 +08:00
cfb67acf6d Merge pull request #156 from brenobaptista/refactored-234
Refactored solution 234
2021-06-26 18:20:44 +08:00
f663cec583 Update ctl templates sorting 2021-06-26 18:20:04 +08:00
e216ed4430 Merge pull request #153 from brenobaptista/suggestion-202
Suggestion 202
2021-06-26 17:34:18 +08:00
7c7f09da99 Merge pull request #152 from brenobaptista/refactored-412
Refactored solution 412 using string concatenation
2021-06-26 17:29:37 +08:00
YDZ
a616d6ea09 Add solution 0576 2021-06-26 03:18:44 +08:00
5e6c9b1fc0 Refactored solution 234 2021-06-24 23:13:31 -03:00
44431beba4 Added English README for problem 617 2021-06-24 21:43:46 -03:00
1cef508aa3 Added tests for problem 617 2021-06-24 21:43:25 -03:00
21c05df2ba Added solution 617 2021-06-24 21:43:07 -03:00
YDZ
b11b8bf09c Update solution 0237 2021-06-24 02:36:57 +08:00
f94128417a Merge pull request #151 from brenobaptista/refactored-237
Refactored solution 237
2021-06-24 02:29:33 +08:00
YDZ
d1c6d8777a Update solution 0065 2021-06-24 02:27:20 +08:00
1198fcc279 Merge pull request #150 from ssezhangpeng/master
add leetcode_0065
2021-06-24 02:18:13 +08:00
YDZ
014e437944 Add solution 0792 2021-06-24 02:13:06 +08:00
1eb35d880f Suggestion for solution 202 2021-06-23 12:06:14 -03:00
c5a9c0fc5c Added a couple more test cases 2021-06-23 12:05:53 -03:00
8ae9b96b33 Refactored solution 412 using string concatenation 2021-06-22 11:00:36 -03:00
871204438b Refactored solution 237 2021-06-21 23:46:37 -03:00
cb1a2124a7 add leetcode_0065 2021-06-22 00:20:14 +08:00
820f3ddd28 add leetcode_0065 2021-06-22 00:12:44 +08:00
873183cc77 Merge branch 'master' of https://github.com/ssezhangpeng/LeetCode-Go-1 2021-06-22 00:02:44 +08:00
8741a38fe2 add leetcode_0065 2021-06-21 23:57:48 +08:00
b273c3f088 add leetcode_0064 2021-06-21 23:56:00 +08:00
578c85e416 Merge pull request #149 from brenobaptista/refactored-101
Refactored solution 101
2021-06-21 08:12:55 +08:00
804bf60609 Refactored solution 101 2021-06-20 19:53:41 -03:00
YDZ
75b8f85315 standardized question title 2021-06-20 16:55:57 +08:00
670 changed files with 29994 additions and 4319 deletions

13
.github/FUNDING.yml vendored Normal file
View File

@ -0,0 +1,13 @@
# These are supported funding model platforms
github: [halfrost]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

4325
README.md

File diff suppressed because it is too large Load Diff

View File

@ -18,7 +18,7 @@ var (
chapterOneFileOrder = []string{"_index", "Data_Structure", "Algorithm", "Time_Complexity"}
chapterOneMenuOrder = []string{"_index", "#关于作者", "Data_Structure", "Algorithm", "Time_Complexity"}
chapterTwoFileOrder = []string{"_index", "Array", "String", "Two_Pointers", "Linked_List", "Stack", "Tree", "Dynamic_Programming", "Backtracking", "Depth_First_Search", "Breadth_First_Search",
"Binary_Search", "Math", "Hash_Table", "Sort", "Bit_Manipulation", "Union_Find", "Sliding_Window", "Segment_Tree", "Binary_Indexed_Tree"}
"Binary_Search", "Math", "Hash_Table", "Sorting", "Bit_Manipulation", "Union_Find", "Sliding_Window", "Segment_Tree", "Binary_Indexed_Tree"}
chapterThreeFileOrder = []string{"_index", "Segment_Tree", "UnionFind", "LRUCache", "LFUCache"}
preNextHeader = "----------------------------------------------\n<div style=\"display: flex;justify-content: space-between;align-items: center;\">\n"
preNextFotter = "</div>"
@ -55,7 +55,7 @@ var (
"Binary_Search": "2.11 Binary Search",
"Math": "2.12 Math",
"Hash_Table": "2.13 Hash Table",
"Sort": "2.14 ✅ Sort",
"Sorting": "2.14 ✅ Sorting",
"Bit_Manipulation": "2.15 ✅ Bit Manipulation",
"Union_Find": "2.16 ✅ Union Find",
"Sliding_Window": "2.17 ✅ Sliding Window",

View File

@ -3,7 +3,7 @@
# 说明
此版本是 https://books.halfrost.com/leetcode 网页的离线版,由于网页版实时会更新,所以此 PDF 版难免会有一些排版或者错别字。如果读者遇到了,可以到网页版相应页面,点击页面 edit 按钮,提交 pr 进行更改。此 PDF 版本号是 V1.5.20。PDF 永久更新地址是 https://github.com/halfrost/LeetCode-Go/releases/,以版本号区分不同版本。笔者还是强烈推荐看在线版,有任何错误都会立即更新。如果觉得此书对刷题有一点点帮助,可以给此书点一个 star鼓励一下笔者早点更新更多题解。
此版本是 https://books.halfrost.com/leetcode 网页的离线版,由于网页版实时会更新,所以此 PDF 版难免会有一些排版或者错别字。如果读者遇到了,可以到网页版相应页面,点击页面 edit 按钮,提交 pr 进行更改。此 PDF 版本号是 V1.5.20。PDF 永久更新地址是 https://github.com/halfrost/leetcode-go/releases/,以版本号区分不同版本。笔者还是强烈推荐看在线版,有任何错误都会立即更新。如果觉得此书对刷题有一点点帮助,可以给此书点一个 star鼓励一下笔者早点更新更多题解。
> 版本号说明V1.5.201 是大版本号5 代表当前题解中有几百题,目前是 520 题,所以第二个版本号是 520 代表当前题解中有几十题,目前是 520 题,所以第三个版本号是 20 。

7
ctl/models/go.mod Normal file
View File

@ -0,0 +1,7 @@
module github.com/halfrost/LeetCode-Go/ctl/models
go 1.19
replace github.com/halfrost/LeetCode-Go/ctl/models => ../util
require github.com/halfrost/LeetCode-Go/ctl/util v0.0.0-20220910225043-e3bb5aff34d0

2
ctl/models/go.sum Normal file
View File

@ -0,0 +1,2 @@
github.com/halfrost/LeetCode-Go/ctl/util v0.0.0-20220910225043-e3bb5aff34d0 h1:WAOAj59szR52uAnEQljAt7ucpbGGOsy0xgR/NeP4Xbc=
github.com/halfrost/LeetCode-Go/ctl/util v0.0.0-20220910225043-e3bb5aff34d0/go.mod h1:+cA8KYcbGxP2Itd3NG+QJVGL/MEZISKlei0tvgDeEag=

View File

@ -14,8 +14,8 @@ type LeetCodeProblemAll struct {
AcMedium int32 `json:"ac_medium"`
AcHard int32 `json:"ac_hard"`
StatStatusPairs []StatStatusPairs `json:"stat_status_pairs"`
FrequencyHigh int32 `json:"frequency_high"`
FrequencyMid int32 `json:"frequency_mid"`
FrequencyHigh float64 `json:"frequency_high"`
FrequencyMid float64 `json:"frequency_mid"`
CategorySlug string `json:"category_slug"`
AcEasyTotal int32
AcMediumTotal int32

View File

@ -24,11 +24,12 @@ func GenerateMdRows(solutionIds []int, mdrows []Mdrow) {
}
for i := 0; i < len(solutionIds); i++ {
if row, ok := mdMap[solutionIds[i]]; ok {
s7 := standardizedTitle(row.QuestionTitle, row.FrontendQuestionID)
mdMap[solutionIds[i]] = Mdrow{
FrontendQuestionID: row.FrontendQuestionID,
QuestionTitle: row.QuestionTitle,
QuestionTitle: strings.TrimSpace(row.QuestionTitle),
QuestionTitleSlug: row.QuestionTitleSlug,
SolutionPath: fmt.Sprintf("[Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/%v)", fmt.Sprintf("%04d.%v", solutionIds[i], strings.Replace(strings.TrimSpace(row.QuestionTitle), " ", "-", -1))),
SolutionPath: fmt.Sprintf("[Go](https://github.com/halfrost/leetcode-go/tree/master/leetcode/%v)", fmt.Sprintf("%04d.%v", solutionIds[i], s7)),
Acceptance: row.Acceptance,
Difficulty: row.Difficulty,
Frequency: row.Frequency,
@ -40,7 +41,7 @@ func GenerateMdRows(solutionIds []int, mdrows []Mdrow) {
for i := range mdrows {
mdrows[i] = Mdrow{
FrontendQuestionID: mdrows[i].FrontendQuestionID,
QuestionTitle: mdrows[i].QuestionTitle,
QuestionTitle: strings.TrimSpace(mdrows[i].QuestionTitle),
QuestionTitleSlug: mdrows[i].QuestionTitleSlug,
SolutionPath: mdMap[int(mdrows[i].FrontendQuestionID)].SolutionPath,
Acceptance: mdrows[i].Acceptance,
@ -51,7 +52,7 @@ func GenerateMdRows(solutionIds []int, mdrows []Mdrow) {
// fmt.Printf("mdrows = %v\n\n", mdrows)
}
// | 0001 | Two Sum | [Go](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0001.Two-Sum)| 45.6% | Easy | |
// | 0001 | Two Sum | [Go](https://github.com/halfrost/leetcode-go/tree/master/leetcode/0001.Two-Sum)| 45.6% | Easy | |
func (m Mdrow) tableLine() string {
return fmt.Sprintf("|%04d|%v|%v|%v|%v||\n", m.FrontendQuestionID, m.QuestionTitle, m.SolutionPath, m.Acceptance, m.Difficulty)
}

View File

@ -32,7 +32,7 @@ type TopicTag struct {
TranslatedName string `json:"translatedName"`
Slug string `json:"slug"`
Questions []Question `json:"questions"`
Frequencies float64 `json:"frequencies"`
Frequencies string `json:"frequencies"`
Typename string `json:"__typename"`
}
@ -115,6 +115,41 @@ func (t TagList) tableLine() string {
return fmt.Sprintf("|%04d|%v|%v|%v|%v|%v|%v|%v|\n", t.FrontendQuestionID, t.QuestionTitle, t.SolutionPath, t.Difficulty, t.TimeComplexity, t.SpaceComplexity, t.Favorite, t.Acceptance)
}
func standardizedTitle(orig string, frontendQuestionID int32) string {
s0 := strings.TrimSpace(orig)
s1 := strings.Replace(s0, " ", "-", -1)
s2 := strings.Replace(s1, "'", "", -1)
s3 := strings.Replace(s2, "%", "", -1)
s4 := strings.Replace(s3, "(", "", -1)
s5 := strings.Replace(s4, ")", "", -1)
s6 := strings.Replace(s5, ",", "", -1)
s7 := strings.Replace(s6, "?", "", -1)
count := 0
// 去掉 --- 这种情况,这种情况是由于题目标题中包含 - ,左右有空格,左右一填充,造成了 ---3 个 -
for i := 0; i < len(s7)-2; i++ {
if s7[i] == '-' && s7[i+1] == '-' && s7[i+2] == '-' {
fmt.Printf("【需要修正 --- 的标题是 %v】\n", fmt.Sprintf("%04d.%v", int(frontendQuestionID), s7))
s7 = s7[:i+1] + s7[i+3:]
count++
}
}
if count > 0 {
fmt.Printf("总共修正了 %v 个标题\n", count)
}
// 去掉 -- 这种情况,这种情况是由于题目标题中包含负号 -
for i := 0; i < len(s7)-2; i++ {
if s7[i] == '-' && s7[i+1] == '-' {
fmt.Printf("【需要修正 -- 的标题是 %v】\n", fmt.Sprintf("%04d.%v", int(frontendQuestionID), s7))
s7 = s7[:i+1] + s7[i+2:]
count++
}
}
if count > 0 {
fmt.Printf("总共修正了 %v 个标题\n", count)
}
return s7
}
// GenerateTagMdRows define
func GenerateTagMdRows(solutionIds []int, metaMap map[int]TagList, mdrows []Mdrow, internal bool) []TagList {
tl := []TagList{}
@ -123,36 +158,7 @@ func GenerateTagMdRows(solutionIds []int, metaMap map[int]TagList, mdrows []Mdro
tmp := TagList{}
tmp.FrontendQuestionID = row.FrontendQuestionID
tmp.QuestionTitle = strings.TrimSpace(row.QuestionTitle)
s1 := strings.Replace(tmp.QuestionTitle, " ", "-", -1)
s2 := strings.Replace(s1, "'", "", -1)
s3 := strings.Replace(s2, "%", "", -1)
s4 := strings.Replace(s3, "(", "", -1)
s5 := strings.Replace(s4, ")", "", -1)
s6 := strings.Replace(s5, ",", "", -1)
s7 := strings.Replace(s6, "?", "", -1)
count := 0
// 去掉 --- 这种情况,这种情况是由于题目标题中包含 - ,左右有空格,左右一填充,造成了 ---3 个 -
for i := 0; i < len(s7)-2; i++ {
if s7[i] == '-' && s7[i+1] == '-' && s7[i+2] == '-' {
fmt.Printf("【需要修正 --- 的标题是 %v】\n", fmt.Sprintf("%04d.%v", int(row.FrontendQuestionID), s7))
s7 = s7[:i+1] + s7[i+3:]
count++
}
}
if count > 0 {
fmt.Printf("总共修正了 %v 个标题\n", count)
}
// 去掉 -- 这种情况,这种情况是由于题目标题中包含负号 -
for i := 0; i < len(s7)-2; i++ {
if s7[i] == '-' && s7[i+1] == '-' {
fmt.Printf("【需要修正 -- 的标题是 %v】\n", fmt.Sprintf("%04d.%v", int(row.FrontendQuestionID), s7))
s7 = s7[:i+1] + s7[i+2:]
count++
}
}
if count > 0 {
fmt.Printf("总共修正了 %v 个标题\n", count)
}
s7 := standardizedTitle(row.QuestionTitle, row.FrontendQuestionID)
if internal {
tmp.SolutionPath = fmt.Sprintf("[Go]({{< relref \"/ChapterFour/%v/%v.md\" >}})", util.GetChpaterFourFileNum(int(row.FrontendQuestionID)), fmt.Sprintf("%04d.%v", int(row.FrontendQuestionID), s7))
} else {
@ -174,8 +180,8 @@ type TagLists struct {
TagLists []TagList
}
//| No. | Title | Solution | Difficulty | TimeComplexity | SpaceComplexity |Favorite| Acceptance |
//|:--------:|:------- | :--------: | :----------: | :----: | :-----: | :-----: |:-----: |
// | No. | Title | Solution | Difficulty | TimeComplexity | SpaceComplexity |Favorite| Acceptance |
// |:--------:|:------- | :--------: | :----------: | :----: | :-----: | :-----: |:-----: |
func (tls TagLists) table() string {
res := "| No. | Title | Solution | Difficulty | TimeComplexity | SpaceComplexity |Favorite| Acceptance |\n"
res += "|:--------:|:------- | :--------: | :----------: | :----: | :-----: | :-----: |:-----: |\n"

View File

@ -18,9 +18,9 @@ type UserInfo struct {
OptimizingEasy int32
OptimizingMedium int32
OptimizingHard int32
FrequencyHigh int32 `json:"frequency_high"`
FrequencyMid int32 `json:"frequency_mid"`
CategorySlug string `json:"category_slug"`
FrequencyHigh float64 `json:"frequency_high"`
FrequencyMid float64 `json:"frequency_mid"`
CategorySlug string `json:"category_slug"`
}
// | | Easy | Medium | Hard | Total | optimizing |

View File

@ -3,14 +3,15 @@ package main
import (
"bufio"
"fmt"
"github.com/halfrost/LeetCode-Go/ctl/util"
"github.com/spf13/cobra"
"io"
"io/ioutil"
"os"
"regexp"
"strconv"
"strings"
"github.com/halfrost/LeetCode-Go/ctl/util"
"github.com/spf13/cobra"
)
var (
@ -23,7 +24,7 @@ var (
# 说明
此版本是 https://books.halfrost.com/leetcode 网页的离线版,由于网页版实时会更新,所以此 PDF 版难免会有一些排版或者错别字。如果读者遇到了,可以到网页版相应页面,点击页面 edit 按钮,提交 pr 进行更改。此 PDF 版本号是 V%v.%v.%v。PDF 永久更新地址是 https://github.com/halfrost/LeetCode-Go/releases/,以版本号区分不同版本。笔者还是强烈推荐看在线版,有任何错误都会立即更新。如果觉得此书对刷题有一点点帮助,可以给此书点一个 star鼓励一下笔者早点更新更多题解。
此版本是 https://books.halfrost.com/leetcode 网页的离线版,由于网页版实时会更新,所以此 PDF 版难免会有一些排版或者错别字。如果读者遇到了,可以到网页版相应页面,点击页面 edit 按钮,提交 pr 进行更改。此 PDF 版本号是 V%v.%v.%v。PDF 永久更新地址是 https://github.com/halfrost/leetcode-go/releases/,以版本号区分不同版本。笔者还是强烈推荐看在线版,有任何错误都会立即更新。如果觉得此书对刷题有一点点帮助,可以给此书点一个 star鼓励一下笔者早点更新更多题解。
> 版本号说明V%v.%v.%v%v 是大版本号,%v 代表当前题解中有几百题,目前是 %v 题,所以第二个版本号是 %v%v 代表当前题解中有几十题,目前是 %v 题,所以第三个版本号是 %v 。

View File

@ -18,11 +18,11 @@ import (
var (
chapterTwoList = []string{"Array", "String", "Two Pointers", "Linked List", "Stack", "Tree", "Dynamic Programming", "Backtracking", "Depth First Search", "Breadth First Search",
"Binary Search", "Math", "Hash Table", "Sort", "Bit Manipulation", "Union Find", "Sliding Window", "Segment Tree", "Binary Indexed Tree"}
"Binary Search", "Math", "Hash Table", "Sorting", "Bit Manipulation", "Union Find", "Sliding Window", "Segment Tree", "Binary Indexed Tree"}
chapterTwoFileName = []string{"Array", "String", "Two_Pointers", "Linked_List", "Stack", "Tree", "Dynamic_Programming", "Backtracking", "Depth_First_Search", "Breadth_First_Search",
"Binary_Search", "Math", "Hash_Table", "Sort", "Bit_Manipulation", "Union_Find", "Sliding_Window", "Segment_Tree", "Binary_Indexed_Tree"}
"Binary_Search", "Math", "Hash_Table", "Sorting", "Bit_Manipulation", "Union_Find", "Sliding_Window", "Segment_Tree", "Binary_Indexed_Tree"}
chapterTwoSlug = []string{"array", "string", "two-pointers", "linked-list", "stack", "tree", "dynamic-programming", "backtracking", "depth-first-search", "breadth-first-search",
"binary-search", "math", "hash-table", "sort", "bit-manipulation", "union-find", "sliding-window", "segment-tree", "binary-indexed-tree"}
"binary-search", "math", "hash-table", "sorting", "bit-manipulation", "union-find", "sliding-window", "segment-tree", "binary-indexed-tree"}
)
func newBuildCommand() *cobra.Command {
@ -163,7 +163,8 @@ func renderReadme(filePath string, total, try int, mdrows, omdrows m.Mdrows, use
}
// internal: true 渲染的链接都是 hugo 内部链接,用户生成 hugo web
// false 渲染的链接是外部 HTTPS 链接,用于生成 PDF
//
// false 渲染的链接是外部 HTTPS 链接,用于生成 PDF
func buildChapterTwo(internal bool) {
var (
gr m.GraphQLResp

View File

@ -3,9 +3,10 @@ package main
import (
"bytes"
"fmt"
"github.com/mozillazg/request"
"io/ioutil"
"net/http"
"github.com/mozillazg/request"
)
const (

View File

@ -1,9 +1,10 @@
package main
import (
"sort"
m "github.com/halfrost/LeetCode-Go/ctl/models"
"github.com/halfrost/LeetCode-Go/ctl/util"
"sort"
)
func statisticalData(problemsMap map[int]m.StatStatusPairs, solutionIds []int) (easyTotal, mediumTotal, hardTotal, optimizingEasy, optimizingMedium, optimizingHard int32, optimizingIds []int) {

View File

@ -1,10 +1,10 @@
---
title: 2.14 ✅ Sort
title: 2.14 ✅ Sorting
type: docs
weight: 14
---
# Sort
# Sorting
![](https://img.halfrost.com/Leetcode/Sort.png)

View File

@ -10,9 +10,9 @@
![](./website/static/wechat-qr-code.png)
<p align='center'>
<a href="https://github.com/halfrost/LeetCode-Go/releases/" rel="nofollow"><img alt="GitHub All Releases" src="https://img.shields.io/github/downloads/halfrost/LeetCode-Go/total?label=PDF%20downloads"></a>
<a href="https://github.com/halfrost/leetcode-go/releases/" rel="nofollow"><img alt="GitHub All Releases" src="https://img.shields.io/github/downloads/halfrost/LeetCode-Go/total?label=PDF%20downloads"></a>
<img src="https://img.shields.io/badge/Total%20Word%20Count-738884-success">
<a href="https://github.com/halfrost/LeetCode-Go/actions" rel="nofollow"><img src="https://github.com/halfrost/LeetCode-Go/workflows/Deploy%20leetcode-cookbook/badge.svg?branch=master"></a>
<a href="https://github.com/halfrost/leetcode-go/actions" rel="nofollow"><img src="https://github.com/halfrost/leetcode-go/workflows/Deploy%20leetcode-cookbook/badge.svg?branch=master"></a>
<a href="https://travis-ci.org/github/halfrost/LeetCode-Go" rel="nofollow"><img src="https://travis-ci.org/halfrost/LeetCode-Go.svg?branch=master"></a>
<a href="https://goreportcard.com/report/github.com/halfrost/LeetCode-Go" rel="nofollow"><img src="https://goreportcard.com/badge/github.com/halfrost/LeetCode-Go"></a>
<img src="https://img.shields.io/badge/runtime%20beats-100%25-success">
@ -23,7 +23,7 @@
</p>
<p align='center'>
<a href="https://github.com/halfrost/LeetCode-Go/blob/master/LICENSE"><img alt="GitHub" src="https://img.shields.io/github/license/halfrost/LeetCode-Go?label=License"></a>
<a href="https://github.com/halfrost/leetcode-go/blob/master/LICENSE"><img alt="GitHub" src="https://img.shields.io/github/license/halfrost/LeetCode-Go?label=License"></a>
<img src="https://img.shields.io/badge/License-CC-000000.svg">
<a href="https://leetcode.com/halfrost/"><img src="https://img.shields.io/badge/@halfrost-8751-yellow.svg">
<img src="https://img.shields.io/badge/language-Golang-26C2F0.svg">
@ -32,7 +32,7 @@
<a href="https://twitter.com/halffrost"><img src="https://img.shields.io/badge/twitter-@halffrost-F8E81C.svg?style=flat&colorA=009df2"></a>
<a href="https://www.zhihu.com/people/halfrost/activities"><img src="https://img.shields.io/badge/%E7%9F%A5%E4%B9%8E-@halfrost-fd6f32.svg?style=flat&colorA=0083ea"></a>
<img src="https://img.shields.io/badge/made%20with-=1-blue.svg">
<a href="https://github.com/halfrost/LeetCode-Go/pulls"><img src="https://img.shields.io/badge/PR-Welcome-brightgreen.svg"></a>
<a href="https://github.com/halfrost/leetcode-go/pulls"><img src="https://img.shields.io/badge/PR-Welcome-brightgreen.svg"></a>
</p>
支持 Progressive Web Apps 和 Dark Mode 的题解电子书《LeetCode Cookbook》 <a href="https://books.halfrost.com/leetcode/" rel="nofollow">Online Reading</a>
@ -42,10 +42,10 @@
<a href="https://books.halfrost.com/leetcode/"><img src="https://img.halfrost.com/Leetcode/Cookbook_Chrome_PWA.png"></a>
</p>
离线版本的电子书《LeetCode Cookbook》PDF <a href="https://github.com/halfrost/LeetCode-Go/releases/" rel="nofollow">Download here</a>
离线版本的电子书《LeetCode Cookbook》PDF <a href="https://github.com/halfrost/leetcode-go/releases/" rel="nofollow">Download here</a>
<p align='center'>
<a href="https://github.com/halfrost/LeetCode-Go/releases/"><img src="https://img.halfrost.com/Leetcode/Cookbook.png"></a>
<a href="https://github.com/halfrost/leetcode-go/releases/"><img src="https://img.halfrost.com/Leetcode/Cookbook.png"></a>
</p>
通过 iOS / Android 浏览器安装 PWA 版《LeetCode Cookbook》至设备桌面随时学习
@ -550,7 +550,7 @@ Problems List in [there](https://books.halfrost.com/leetcode/ChapterTwo/Bit_Mani
![](./topic/Union_Find.png)
- 灵活使用并查集的思想,熟练掌握并查集的[模板](https://github.com/halfrost/LeetCode-Go/blob/master/template/UnionFind.go),模板中有两种并查集的实现方式,一种是路径压缩 + 秩优化的版本,另外一种是计算每个集合中元素的个数 + 最大集合元素个数的版本,这两种版本都有各自使用的地方。能使用第一类并查集模板的题目有:第 128 题,第 130 题,第 547 题,第 684 题,第 721 题,第 765 题,第 778 题,第 839 题,第 924 题,第 928 题,第 947 题,第 952 题,第 959 题,第 990 题。能使用第二类并查集模板的题目有:第 803 题,第 952 题。第 803 题秩优化和统计集合个数这些地方会卡时间,如果不优化,会 TLE。
- 灵活使用并查集的思想,熟练掌握并查集的[模板](https://github.com/halfrost/leetcode-go/blob/master/template/UnionFind.go),模板中有两种并查集的实现方式,一种是路径压缩 + 秩优化的版本,另外一种是计算每个集合中元素的个数 + 最大集合元素个数的版本,这两种版本都有各自使用的地方。能使用第一类并查集模板的题目有:第 128 题,第 130 题,第 547 题,第 684 题,第 721 题,第 765 题,第 778 题,第 839 题,第 924 题,第 928 题,第 947 题,第 952 题,第 959 题,第 990 题。能使用第二类并查集模板的题目有:第 803 题,第 952 题。第 803 题秩优化和统计集合个数这些地方会卡时间,如果不优化,会 TLE。
- 并查集是一种思想,有些题需要灵活使用这种思想,而不是死套模板,如第 399 题,这一题是 stringUnionFind利用并查集思想实现的。这里每个节点是基于字符串和 map 的,而不是单纯的用 int 节点编号实现的。
- 有些题死套模板反而做不出来,比如第 685 题,这一题不能路径压缩和秩优化,因为题目中涉及到有向图,需要知道节点的前驱节点,如果路径压缩了,这一题就没法做了。这一题不需要路径压缩和秩优化。
- 灵活的抽象题目给的信息,将给定的信息合理的编号,使用并查集解题,并用 map 降低时间复杂度,如第 721 题,第 959 题。
@ -630,10 +630,10 @@ Problems List in [there](https://books.halfrost.com/leetcode/ChapterTwo/Binary_I
----------------------------------------------------------------------------------------
<p align='center'>
<a href="https://github.com/halfrost/LeetCode-Go/releases/tag/Special"><img src="https://img.halfrost.com/Leetcode/ACM-ICPC_Algorithm_Template.png"></a>
<a href="https://github.com/halfrost/leetcode-go/releases/tag/Special"><img src="https://img.halfrost.com/Leetcode/ACM-ICPC_Algorithm_Template.png"></a>
</p>
Thank you for reading here. This is bonus. You can download my [《ACM-ICPC Algorithm Template》](https://github.com/halfrost/LeetCode-Go/releases/tag/Special/)
Thank you for reading here. This is bonus. You can download my [《ACM-ICPC Algorithm Template》](https://github.com/halfrost/leetcode-go/releases/tag/Special/)

View File

@ -3,11 +3,12 @@ package main
import (
"bytes"
"fmt"
m "github.com/halfrost/LeetCode-Go/ctl/models"
"github.com/halfrost/LeetCode-Go/ctl/util"
"html/template"
"io/ioutil"
"os"
m "github.com/halfrost/LeetCode-Go/ctl/models"
"github.com/halfrost/LeetCode-Go/ctl/util"
)
func makeReadmeFile(mdrows m.Mdrows) {

3
ctl/util/go.mod Normal file
View File

@ -0,0 +1,3 @@
module github.com/halfrost/LeetCode-Go/ctl/util
go 1.19

29
go.mod
View File

@ -1,13 +1,30 @@
module github.com/halfrost/LeetCode-Go
go 1.15
go 1.19
replace github.com/halfrost/LeetCode-Go/structures => ./structures
replace github.com/halfrost/LeetCode-Go/template => ./template
replace github.com/halfrost/LeetCode-Go/ctl/util => ./ctl/util
replace github.com/halfrost/LeetCode-Go/ctl/models => ./ctl/models
require (
github.com/BurntSushi/toml v1.2.0
github.com/halfrost/LeetCode-Go/ctl/models v0.0.0-20220910225043-e3bb5aff34d0
github.com/halfrost/LeetCode-Go/ctl/util v0.0.0-20220910225043-e3bb5aff34d0
github.com/halfrost/LeetCode-Go/structures v0.0.0-20220910233101-aa0e2c897b18
github.com/halfrost/LeetCode-Go/template v0.0.0-20220910233504-e2a72e6212ce
github.com/mozillazg/request v0.8.0
github.com/spf13/cobra v1.5.0
)
require (
github.com/BurntSushi/toml v0.3.1
github.com/bitly/go-simplejson v0.5.0 // indirect
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 // indirect
github.com/mozillazg/request v0.8.0
github.com/spf13/cobra v1.1.1
github.com/stretchr/testify v1.3.0
golang.org/x/net v0.0.0-20201021035429-f5854403a974 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/kr/pretty v0.3.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
golang.org/x/net v0.17.0 // indirect
)

303
go.sum
View File

@ -1,303 +1,36 @@
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU=
cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU=
cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY=
cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc=
cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0=
cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o=
cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE=
cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk=
cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I=
cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
github.com/BurntSushi/toml v1.2.0 h1:Rt8g24XnyGTyglgET/PRUNlrUeu9F5L+7FilkXfZgs0=
github.com/BurntSushi/toml v1.2.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/bitly/go-simplejson v0.5.0 h1:6IH+V8/tVMab511d5bn4M7EwGXZf9Hj6i2xSwkNEM+Y=
github.com/bitly/go-simplejson v0.5.0/go.mod h1:cXHtHw4XUPsvGaxgjIAn8PhEWG9NfngEKAMDJEczWVA=
github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84=
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 h1:DDGfHa7BWjL4YnC6+E63dPcxHo2sUxDIu8g3QgEJdRY=
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4=
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q=
github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU=
github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU=
github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4=
github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90=
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64=
github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ=
github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I=
github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc=
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI=
github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg=
github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY=
github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/mozillazg/request v0.8.0 h1:TbXeQUdBWr1J1df5Z+lQczDFzX9JD71kTCl7Zu/9rNM=
github.com/mozillazg/request v0.8.0/go.mod h1:weoQ/mVFNbWgRBtivCGF1tUT9lwneFesues+CleXMWc=
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso=
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
github.com/spf13/cobra v1.1.1 h1:KfztREH0tPxJJ+geloSLaAkaPkr4ki2Er5quFV1TDo4=
github.com/spf13/cobra v1.1.1/go.mod h1:WnodtKOvamDL/PwE2M4iKs8aMDBZ5Q5klgD3qfVJQMI=
github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k=
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/spf13/cobra v1.5.0 h1:X+jTBEBqF0bHN+9cSMgmfuvv2VHJ9ezmFNf9Y/XstYU=
github.com/spf13/cobra v1.5.0/go.mod h1:dWXEIy2H428czQCjInthrTRUg7yKbok+2Qi/yBIJoUM=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek=
golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o=
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M=
google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=
google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=
google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0=
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8=
google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM=
golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=

View File

@ -31,15 +31,16 @@ func lengthOfLongestSubstring1(s string) int {
if len(s) == 0 {
return 0
}
var freq [256]int
var freq [127]int
result, left, right := 0, 0, -1
for left < len(s) {
if right+1 < len(s) && freq[s[right+1]-'a'] == 0 {
freq[s[right+1]-'a']++
if right+1 < len(s) && freq[s[right+1]] == 0 {
freq[s[right+1]]++
right++
} else {
freq[s[left]-'a']--
freq[s[left]]--
left++
}
result = max(result, right-left+1)

View File

@ -34,7 +34,7 @@ Explanation: The answer is "wke", with the length of 3.
## 题目大意
在一个字符串寻找没有重复字母的最长子串。
在一个字符串寻找没有重复字母的最长子串。
## 解题思路

View File

@ -0,0 +1,16 @@
package leetcode
func longestCommonPrefix(strs []string) string {
prefix := strs[0]
for i := 1; i < len(strs); i++ {
for j := 0; j < len(prefix); j++ {
if len(strs[i]) <= j || strs[i][j] != prefix[j] {
prefix = prefix[0:j]
break
}
}
}
return prefix
}

View File

@ -0,0 +1,50 @@
package leetcode
import (
"fmt"
"testing"
)
type question14 struct {
para14
ans14
}
// para 是参数
type para14 struct {
strs []string
}
// ans 是答案
type ans14 struct {
ans string
}
func Test_Problem14(t *testing.T) {
qs := []question14{
{
para14{[]string{"flower", "flow", "flight"}},
ans14{"fl"},
},
{
para14{[]string{"dog", "racecar", "car"}},
ans14{""},
},
{
para14{[]string{"ab", "a"}},
ans14{"a"},
},
}
fmt.Printf("------------------------Leetcode Problem 14------------------------\n")
for _, q := range qs {
_, p := q.ans14, q.para14
fmt.Printf("【input】:%v 【output】:%v\n", p.strs, longestCommonPrefix(p.strs))
}
fmt.Printf("\n\n\n")
}

View File

@ -0,0 +1,57 @@
# [14. Longest Common Prefix](https://leetcode.com/problems/longest-common-prefix/)
## 题目
Write a function to find the longest common prefix string amongst an array of strings.
If there is no common prefix, return an empty string "".
**Example 1**:
Input: strs = ["flower","flow","flight"]
Output: "fl"
**Example 2**:
Input: strs = ["dog","racecar","car"]
Output: ""
Explanation: There is no common prefix among the input strings.
**Constraints:**
- 1 <= strs.length <= 200
- 0 <= strs[i].length <= 200
- strs[i] consists of only lower-case English letters.
## 题目大意
编写一个函数来查找字符串数组中的最长公共前缀。
如果不存在公共前缀,返回空字符串 ""。
## 解题思路
- 对 strs 按照字符串长度进行升序排序,求出 strs 中长度最小字符串的长度 minLen
- 逐个比较长度最小字符串与其它字符串中的字符,如果不相等就返回 commonPrefix,否则就把该字符加入 commonPrefix
## 代码
```go
package leetcode
func longestCommonPrefix(strs []string) string {
prefix := strs[0]
for i := 1; i < len(strs); i++ {
for j := 0; j < len(prefix); j++ {
if len(strs[i]) <= j || strs[i][j] != prefix[j] {
prefix = prefix[0:j]
break
}
}
}
return prefix
}
```

View File

@ -11,6 +11,9 @@ func threeSumClosest(nums []int, target int) int {
if n > 2 {
sort.Ints(nums)
for i := 0; i < n-2; i++ {
if i > 0 && nums[i] == nums[i-1] {
continue
}
for j, k := i+1, n-1; j < k; {
sum := nums[i] + nums[j] + nums[k]
if abs(sum-target) < diff {

View File

@ -2,7 +2,92 @@ package leetcode
import "sort"
func fourSum(nums []int, target int) [][]int {
// 解法一 双指针
func fourSum(nums []int, target int) (quadruplets [][]int) {
sort.Ints(nums)
n := len(nums)
for i := 0; i < n-3 && nums[i]+nums[i+1]+nums[i+2]+nums[i+3] <= target; i++ {
if i > 0 && nums[i] == nums[i-1] || nums[i]+nums[n-3]+nums[n-2]+nums[n-1] < target {
continue
}
for j := i + 1; j < n-2 && nums[i]+nums[j]+nums[j+1]+nums[j+2] <= target; j++ {
if j > i+1 && nums[j] == nums[j-1] || nums[i]+nums[j]+nums[n-2]+nums[n-1] < target {
continue
}
for left, right := j+1, n-1; left < right; {
if sum := nums[i] + nums[j] + nums[left] + nums[right]; sum == target {
quadruplets = append(quadruplets, []int{nums[i], nums[j], nums[left], nums[right]})
for left++; left < right && nums[left] == nums[left-1]; left++ {
}
for right--; left < right && nums[right] == nums[right+1]; right-- {
}
} else if sum < target {
left++
} else {
right--
}
}
}
}
return
}
// 解法二 kSum
func fourSum1(nums []int, target int) [][]int {
res, cur := make([][]int, 0), make([]int, 0)
sort.Ints(nums)
kSum(nums, 0, len(nums)-1, target, 4, cur, &res)
return res
}
func kSum(nums []int, left, right int, target int, k int, cur []int, res *[][]int) {
if right-left+1 < k || k < 2 || target < nums[left]*k || target > nums[right]*k {
return
}
if k == 2 {
// 2 sum
twoSum(nums, left, right, target, cur, res)
} else {
for i := left; i < len(nums); i++ {
if i == left || (i > left && nums[i-1] != nums[i]) {
next := make([]int, len(cur))
copy(next, cur)
next = append(next, nums[i])
kSum(nums, i+1, len(nums)-1, target-nums[i], k-1, next, res)
}
}
}
}
func twoSum(nums []int, left, right int, target int, cur []int, res *[][]int) {
for left < right {
sum := nums[left] + nums[right]
if sum == target {
cur = append(cur, nums[left], nums[right])
temp := make([]int, len(cur))
copy(temp, cur)
*res = append(*res, temp)
// reset cur to previous state
cur = cur[:len(cur)-2]
left++
right--
for left < right && nums[left] == nums[left-1] {
left++
}
for left < right && nums[right] == nums[right+1] {
right--
}
} else if sum < target {
left++
} else {
right--
}
}
}
// 解法三
func fourSum2(nums []int, target int) [][]int {
res := [][]int{}
counter := map[int]int{}
for _, value := range nums {

View File

@ -1,4 +1,4 @@
# [28. Implement strStr()](https://leetcode.com/problems/implement-strstr/)
# [28. Find the Index of the First Occurrence in a String](https://leetcode.com/problems/find-the-index-of-the-first-occurrence-in-a-string/)
## 题目

View File

@ -1,5 +1,6 @@
package leetcode
// 解法一
func nextPermutation(nums []int) {
i, j := 0, 0
for i = len(nums) - 2; i >= 0; i-- {
@ -29,3 +30,43 @@ func reverse(nums *[]int, i, j int) {
func swap(nums *[]int, i, j int) {
(*nums)[i], (*nums)[j] = (*nums)[j], (*nums)[i]
}
// 解法二
// [2,(3),6,5,4,1] -> 2,(4),6,5,(3),1 -> 2,4, 1,3,5,6
func nextPermutation1(nums []int) {
var n = len(nums)
var pIdx = checkPermutationPossibility(nums)
if pIdx == -1 {
reverse(&nums, 0, n-1)
return
}
var rp = len(nums) - 1
// start from right most to leftward,find the first number which is larger than PIVOT
for rp > 0 {
if nums[rp] > nums[pIdx] {
swap(&nums, pIdx, rp)
break
} else {
rp--
}
}
// Finally, Reverse all elements which are right from pivot
reverse(&nums, pIdx+1, n-1)
}
// checkPermutationPossibility returns 1st occurrence Index where
// value is in decreasing order(from right to left)
// returns -1 if not found(it's already in its last permutation)
func checkPermutationPossibility(nums []int) (idx int) {
// search right to left for 1st number(from right) that is not in increasing order
var rp = len(nums) - 1
for rp > 0 {
if nums[rp-1] < nums[rp] {
idx = rp - 1
return idx
}
rp--
}
return -1
}

View File

@ -45,4 +45,4 @@ candidates 中的每个数字在每个组合中只能使用一次。
## 解题思路
- 题目要求出总和为 sum 的所有组合,组合需要去重。这一题是第 39 题的加强版,第 39 题中元素可以重复利用(重复元素可无限次使用),这一题中元素只能有限次数的利用,因为存在重复元素,并且每个元素只能用一次(重复元素只能使用有限次)
- 这一题和第 47 题类似,只不过元素可以反复使用
- 这一题和第 47 题类似。

View File

@ -1,5 +1,6 @@
package leetcode
// 解法一
func rotate(matrix [][]int) {
length := len(matrix)
// rotate by diagonal 对角线变换
@ -15,3 +16,46 @@ func rotate(matrix [][]int) {
}
}
}
// 解法二
func rotate1(matrix [][]int) {
n := len(matrix)
if n == 1 {
return
}
/* rotate clock-wise = 1. transpose matrix => 2. reverse(matrix[i])
1 2 3 4 1 5 9 13 13 9 5 1
5 6 7 8 => 2 6 10 14 => 14 10 6 2
9 10 11 12 3 7 11 15 15 11 7 3
13 14 15 16 4 8 12 16 16 12 8 4
*/
for i := 0; i < n; i++ {
// transpose, i=rows, j=columns
// j = i+1, coz diagonal elements didn't change in a square matrix
for j := i + 1; j < n; j++ {
swap(matrix, i, j)
}
// reverse each row of the image
matrix[i] = reverse(matrix[i])
}
}
// swap changes original slice's i,j position
func swap(nums [][]int, i, j int) {
nums[i][j], nums[j][i] = nums[j][i], nums[i][j]
}
// reverses a row of image, matrix[i]
func reverse(nums []int) []int {
var lp, rp = 0, len(nums) - 1
for lp < rp {
nums[lp], nums[rp] = nums[rp], nums[lp]
lp++
rp--
}
return nums
}

View File

@ -0,0 +1,16 @@
package leetcode
func lengthOfLastWord(s string) int {
last := len(s) - 1
for last >= 0 && s[last] == ' ' {
last--
}
if last < 0 {
return 0
}
first := last
for first >= 0 && s[first] != ' ' {
first--
}
return last - first
}

View File

@ -0,0 +1,50 @@
package leetcode
import (
"fmt"
"testing"
)
type question58 struct {
para58
ans58
}
// para 是参数
type para58 struct {
s string
}
// ans 是答案
type ans58 struct {
ans int
}
func Test_Problem58(t *testing.T) {
qs := []question58{
{
para58{"Hello World"},
ans58{5},
},
{
para58{" fly me to the moon "},
ans58{4},
},
{
para58{"luffy is still joyboy"},
ans58{6},
},
}
fmt.Printf("------------------------Leetcode Problem 58------------------------\n")
for _, q := range qs {
_, p := q.ans58, q.para58
fmt.Printf("【input】:%v 【output】:%v\n", p, lengthOfLastWord(p.s))
}
fmt.Printf("\n\n\n")
}

View File

@ -0,0 +1,70 @@
# [58. Length of Last Word](https://leetcode.com/problems/length-of-last-word/)
## 题目
Given a string `s` consisting of some words separated by some number of spaces, return *the length of the **last** word in the string.*
A **word** is a maximal substring consisting of non-space characters only.
**Example 1:**
```
Input: s = "Hello World"
Output: 5
Explanation: The last word is "World" with length 5.
```
**Example 2:**
```
Input: s = " fly me to the moon "
Output: 4
Explanation: The last word is "moon" with length 4.
```
**Example 3:**
```
Input: s = "luffy is still joyboy"
Output: 6
Explanation: The last word is "joyboy" with length 6.
```
**Constraints:**
- `1 <= s.length <= 104`
- `s` consists of only English letters and spaces `' '`.
- There will be at least one word in `s`.
## 题目大意
给你一个字符串 `s`,由若干单词组成,单词前后用一些空格字符隔开。返回字符串中最后一个单词的长度。**单词** 是指仅由字母组成、不包含任何空格字符的最大子字符串。
## 解题思路
- 先从后过滤掉空格找到单词尾部,再从尾部向前遍历,找到单词头部,最后两者相减,即为单词的长度。
## 代码
```go
package leetcode
func lengthOfLastWord(s string) int {
last := len(s) - 1
for last >= 0 && s[last] == ' ' {
last--
}
if last < 0 {
return 0
}
first := last
for first >= 0 && s[first] != ' ' {
first--
}
return last - first
}
```

View File

@ -0,0 +1,22 @@
package leetcode
func isNumber(s string) bool {
numFlag, dotFlag, eFlag := false, false, false
for i := 0; i < len(s); i++ {
if '0' <= s[i] && s[i] <= '9' {
numFlag = true
} else if s[i] == '.' && !dotFlag && !eFlag {
dotFlag = true
} else if (s[i] == 'e' || s[i] == 'E') && !eFlag && numFlag {
eFlag = true
numFlag = false // reJudge integer after 'e' or 'E'
} else if (s[i] == '+' || s[i] == '-') && (i == 0 || s[i-1] == 'e' || s[i-1] == 'E') {
continue
} else {
return false
}
}
// avoid case: s == '.' or 'e/E' or '+/-' and etc...
// string s must have num
return numFlag
}

View File

@ -0,0 +1,41 @@
package leetcode
import (
"fmt"
"testing"
)
func Test_Problem65(t *testing.T) {
tcs := []struct {
s string
ans bool
}{
{
"0",
true,
},
{
"e",
false,
},
{
".",
false,
},
{
".1",
true,
},
}
fmt.Printf("------------------------Leetcode Problem 65------------------------\n")
for _, tc := range tcs {
fmt.Printf("【input】:%v 【output】:%v\n", tc, isNumber(tc.s))
}
fmt.Printf("\n\n\n")
}

View File

@ -0,0 +1,78 @@
# [65. Valid Number](https://leetcode.com/problems/valid-number/)
## 题目
A **valid number** can be split up into these components (in order):
1. A **decimal number** or an integer.
2. (Optional) An 'e' or 'E', followed by an **integer.**
A **decimal number** can be split up into these components (in order):
1. (Optional) A sign character (either '+' or '-').
2. One of the following formats:
1. One or more digits, followed by a dot '.'.
2. One or more digits, followed by a dot '.', followed by one or more digits.
3. A dot '.', followed by one or more digits.
An **integer** can be split up into these components (in order):
1. (Optional) A sign character (either '+' or '-').
2. One or more digits.
For example, all the following are valid numbers: `["2", "0089", "-0.1", "+3.14", "4.", "-.9", "2e10", "-90E3", "3e+7", "+6e-1", "53.5e93", "-123.456e789"]`, while the following are not valid numbers: `["abc", "1a", "1e", "e3", "99e2.5", "--6", "-+3", "95a54e53"].`
Given a string s, return true if s is a **valid number.**
**Example:**
Input: s = "0"
Output: true
Input: s = "e"
Output: false
## 题目大意
给定一个字符串S请根据以上的规则判断该字符串是否是一个有效的数字字符串。
## 解题思路
- 用三个变量分别标记是否出现过数字、是否出现过'.'和 是否出现过 'e/E'
- 从左到右依次遍历字符串中的每一个元素
- 如果是数字,则标记数字出现过
- 如果是 '.', 则需要 '.'没有出现过,并且 'e/E' 没有出现过,才会进行标记
- 如果是 'e/E', 则需要 'e/E'没有出现过,并且前面出现过数字,才会进行标记
- 如果是 '+/-', 则需要是第一个字符,或者前一个字符是 'e/E',才会进行标记,并重置数字出现的标识
- 最后返回时需要字符串中至少出现过数字避免下列case: s == '.' or 'e/E' or '+/e' and etc...
## 代码
```go
package leetcode
func isNumber(s string) bool {
numFlag, dotFlag, eFlag := false, false, false
for i := 0; i < len(s); i++ {
if '0' <= s[i] && s[i] <= '9' {
numFlag = true
} else if s[i] == '.' && !dotFlag && !eFlag {
dotFlag = true
} else if (s[i] == 'e' || s[i] == 'E') && !eFlag && numFlag {
eFlag = true
numFlag = false // reJudge integer after 'e' or 'E'
} else if (s[i] == '+' || s[i] == '-') && (i == 0 || s[i-1] == 'e' || s[i-1] == 'E') {
continue
} else {
return false
}
}
// avoid case: s == '.' or 'e/E' or '+/-' and etc...
// string s must have num
return numFlag
}
```

View File

@ -1,8 +1,8 @@
package leetcode
import "math"
import (
"math"
"github.com/halfrost/LeetCode-Go/structures"
)

View File

@ -18,20 +18,20 @@ type TreeNode = structures.TreeNode
// 解法一 dfs
func isSymmetric(root *TreeNode) bool {
return root == nil || dfs(root.Left, root.Right)
}
func dfs(rootLeft, rootRight *TreeNode) bool {
if rootLeft == nil && rootRight == nil {
if root == nil {
return true
}
if rootLeft == nil || rootRight == nil {
return isMirror(root.Left, root.Right)
}
func isMirror(left *TreeNode, right *TreeNode) bool {
if left == nil && right == nil {
return true
}
if left == nil || right == nil {
return false
}
if rootLeft.Val != rootRight.Val {
return false
}
return dfs(rootLeft.Left, rootRight.Right) && dfs(rootLeft.Right, rootRight.Left)
return (left.Val == right.Val) && isMirror(left.Left, right.Right) && isMirror(left.Right, right.Left)
}
// 解法二

View File

@ -16,7 +16,23 @@ type TreeNode = structures.TreeNode
* }
*/
// 解法一, 直接传入需要的 slice 范围作为输入, 可以避免申请对应 inorder 索引的内存, 内存使用(leetcode test case) 4.7MB -> 4.3MB.
func buildTree(preorder []int, inorder []int) *TreeNode {
if len(preorder) == 0 {
return nil
}
root := &TreeNode{Val: preorder[0]}
for pos, node := range inorder {
if node == root.Val {
root.Left = buildTree(preorder[1:pos+1], inorder[:pos])
root.Right = buildTree(preorder[pos+1:], inorder[pos+1:])
}
}
return root
}
// 解法二
func buildTree1(preorder []int, inorder []int) *TreeNode {
inPos := make(map[int]int)
for i := 0; i < len(inorder); i++ {
inPos[inorder[i]] = i

View File

@ -16,7 +16,25 @@ type TreeNode = structures.TreeNode
* }
*/
// 解法一, 直接传入需要的 slice 范围作为输入, 可以避免申请对应 inorder 索引的内存, 内存使用(leetcode test case) 4.7MB -> 4.3MB.
func buildTree(inorder []int, postorder []int) *TreeNode {
postorderLen := len(postorder)
if len(inorder) == 0 {
return nil
}
root := &TreeNode{Val: postorder[postorderLen-1]}
postorder = postorder[:postorderLen-1]
for pos, node := range inorder {
if node == root.Val {
root.Left = buildTree(inorder[:pos], postorder[:len(inorder[:pos])])
root.Right = buildTree(inorder[pos+1:], postorder[len(inorder[:pos]):])
}
}
return root
}
// 解法二
func buildTree1(inorder []int, postorder []int) *TreeNode {
inPos := make(map[int]int)
for i := 0; i < len(inorder); i++ {
inPos[inorder[i]] = i

View File

@ -18,23 +18,21 @@ type TreeNode = structures.TreeNode
// 解法一 非递归
func flatten(root *TreeNode) {
list, cur := []int{}, &TreeNode{}
preorder(root, &list)
cur = root
list := preorder(root)
for i := 1; i < len(list); i++ {
cur.Left = nil
cur.Right = &TreeNode{Val: list[i], Left: nil, Right: nil}
cur = cur.Right
prev, cur := list[i-1], list[i]
prev.Left, prev.Right = nil, cur
}
return
}
func preorder(root *TreeNode, output *[]int) {
func preorder(root *TreeNode) (ans []*TreeNode) {
if root != nil {
*output = append(*output, root.Val)
preorder(root.Left, output)
preorder(root.Right, output)
ans = append(ans, root)
ans = append(ans, preorder(root.Left)...)
ans = append(ans, preorder(root.Right)...)
}
return
}
// 解法二 递归

View File

@ -15,13 +15,13 @@ type question114 struct {
// para 是参数
// one 代表第一个参数
type para114 struct {
one []int
one []string
}
// ans 是答案
// one 代表第一个答案
type ans114 struct {
one []int
one []string
}
func Test_Problem114(t *testing.T) {
@ -29,8 +29,18 @@ func Test_Problem114(t *testing.T) {
qs := []question114{
{
para114{[]int{1, 2, 3, 4, 5, 6}},
ans114{[]int{1, 2, 3, 4, 5, 6}},
para114{[]string{"1", "2", "5", "3", "4", "null", "6"}},
ans114{[]string{"1", "null", "2", "null", "3", "null", "4", "null", "5", "null", "6"}},
},
{
para114{[]string{"0"}},
ans114{[]string{"0"}},
},
{
para114{[]string{"1", "2", "3", "4", "5", "6"}},
ans114{[]string{"1", "2", "4", "5", "3", "6", "null"}},
},
}
@ -39,9 +49,10 @@ func Test_Problem114(t *testing.T) {
for _, q := range qs {
_, p := q.ans114, q.para114
fmt.Printf("【input】:%v \n", p)
rootOne := structures.Ints2TreeNode(p.one)
rootOne := structures.Strings2TreeNode(p.one)
flatten(rootOne)
fmt.Printf("【output】:%v \n", structures.Tree2Preorder(rootOne))
fmt.Printf("【levelorder output】:%v \n", structures.Tree2LevelOrderStrings(rootOne))
fmt.Printf("【preorder output】:%v \n", structures.Tree2PreOrderStrings(rootOne))
}
fmt.Printf("\n\n\n")
}

View File

@ -0,0 +1,52 @@
package leetcode
type Node struct {
Val int
Left *Node
Right *Node
Next *Node
}
// 解法一:迭代
func connect(root *Node) *Node {
if root == nil {
return root
}
q := []*Node{root}
for len(q) > 0 {
var p []*Node
// 遍历这一层的所有节点
for i, node := range q {
if i+1 < len(q) {
node.Next = q[i+1]
}
if node.Left != nil {
p = append(p, node.Left)
}
if node.Right != nil {
p = append(p, node.Right)
}
}
q = p
}
return root
}
// 解法二 递归
func connect2(root *Node) *Node {
if root == nil {
return nil
}
connectTwoNode(root.Left, root.Right)
return root
}
func connectTwoNode(node1, node2 *Node) {
if node1 == nil || node2 == nil {
return
}
node1.Next = node2
connectTwoNode(node1.Left, node1.Right)
connectTwoNode(node2.Left, node2.Right)
connectTwoNode(node1.Right, node2.Left)
}

View File

@ -0,0 +1,117 @@
package leetcode
import (
"fmt"
"testing"
)
type question116 struct {
para116
ans116
}
// para 是参数
// one 代表第一个参数
type para116 struct {
one *Node
}
// ans 是答案
// one 代表第一个答案
type ans116 struct {
one *Node
}
func newQuestionNode() *Node {
node7 := &Node{}
node7.Val = 7
node6 := &Node{}
node6.Val = 6
node5 := &Node{}
node5.Val = 5
node4 := &Node{}
node4.Val = 4
node3 := &Node{}
node3.Val = 3
node2 := &Node{}
node2.Val = 2
node1 := &Node{}
node1.Val = 1
node1.Left = node2
node1.Right = node3
node2.Left = node4
node2.Right = node5
node3.Left = node6
node3.Right = node7
return node1
}
func newResultNode() *Node {
node7 := &Node{}
node7.Val = 7
node6 := &Node{}
node6.Val = 6
node5 := &Node{}
node5.Val = 5
node4 := &Node{}
node4.Val = 4
node3 := &Node{}
node3.Val = 3
node2 := &Node{}
node2.Val = 2
node1 := &Node{}
node1.Val = 1
node1.Left = node2
node1.Right = node3
node2.Left = node4
node2.Right = node5
node3.Left = node6
node3.Right = node7
node1.Next = nil
node2.Next = node3
node3.Next = nil
node4.Next = node5
node5.Next = node6
node6.Next = node7
node7.Next = nil
return node1
}
func Test_Problem116(t *testing.T) {
qs := []question116{
{
para116{newQuestionNode()},
ans116{newResultNode()},
},
}
fmt.Printf("------------------------Leetcode Problem 116------------------------\n")
for _, q := range qs {
_, p := q.ans116, q.para116
fmt.Printf("【input】:%v ", p.one)
fmt.Printf("【output】:%v \n", connect(p.one))
}
fmt.Printf("\n\n\n")
}

View File

@ -0,0 +1,118 @@
# [116. Populating Next Right Pointers in Each Node](https://leetcode.com/problems/populating-next-right-pointers-in-each-node/)
## 题目
You are given a **perfect binary tree** where all leaves are on the same level, and every parent has two children. The binary tree has the following definition:
```
struct Node {
int val;
Node *left;
Node *right;
Node *next;
}
```
Populate each next pointer to point to its next right node. If there is no next right node, the next pointer should be set to `NULL`.
Initially, all next pointers are set to `NULL`.
**Follow up:**
- You may only use constant extra space.
- Recursive approach is fine, you may assume implicit stack space does not count as extra space for this problem.
**Example 1:**
![https://assets.leetcode.com/uploads/2019/02/14/116_sample.png](https://assets.leetcode.com/uploads/2019/02/14/116_sample.png)
```
Input: root = [1,2,3,4,5,6,7]
Output: [1,#,2,3,#,4,5,6,7,#]
Explanation:Given the above perfect binary tree (Figure A), your function should populate each next pointer to point to its next right node, just like in Figure B. The serialized output is in level order as connected by the next pointers, with '#' signifying the end of each level.
```
**Constraints:**
- The number of nodes in the given tree is less than `4096`.
- `1000 <= node.val <= 1000`
## 题目大意
给定一个 完美二叉树 ,其所有叶子节点都在同一层,每个父节点都有两个子节点。二叉树定义如下:
```jsx
struct Node {
int val;
Node *left;
Node *right;
Node *next;
}
```
填充它的每个 next 指针,让这个指针指向其下一个右侧节点。如果找不到下一个右侧节点,则将 next 指针设置为 NULL。初始状态下所有 next 指针都被设置为 NULL。
## 解题思路
- 本质上是二叉树的层序遍历,基于广度优先搜索,将每层的节点放入队列,并遍历队列进行连接。
## 代码
```go
package leetcode
type Node struct {
Val int
Left *Node
Right *Node
Next *Node
}
//解法一:迭代
func connect(root *Node) *Node {
if root == nil {
return root
}
q := []*Node{root}
for len(q) > 0 {
var p []*Node
// 遍历这一层的所有节点
for i, node := range q {
if i+1 < len(q) {
node.Next = q[i+1]
}
if node.Left != nil {
p = append(p, node.Left)
}
if node.Right != nil {
p = append(p, node.Right)
}
}
q = p
}
return root
}
// 解法二 递归
func connect2(root *Node) *Node {
if root == nil {
return nil
}
connectTwoNode(root.Left, root.Right)
return root
}
func connectTwoNode(node1, node2 *Node) {
if node1 == nil || node2 == nil {
return
}
node1.Next = node2
connectTwoNode(node1.Left, node1.Right)
connectTwoNode(node2.Left, node2.Right)
connectTwoNode(node1.Right, node2.Left)
}
```

View File

@ -1,8 +1,8 @@
package leetcode
import "math"
import (
"math"
"github.com/halfrost/LeetCode-Go/structures"
)

View File

@ -0,0 +1,20 @@
package leetcode
func candy(ratings []int) int {
candies := make([]int, len(ratings))
for i := 1; i < len(ratings); i++ {
if ratings[i] > ratings[i-1] {
candies[i] += candies[i-1] + 1
}
}
for i := len(ratings) - 2; i >= 0; i-- {
if ratings[i] > ratings[i+1] && candies[i] <= candies[i+1] {
candies[i] = candies[i+1] + 1
}
}
total := 0
for _, candy := range candies {
total += candy + 1
}
return total
}

View File

@ -0,0 +1,47 @@
package leetcode
import (
"fmt"
"testing"
)
type question135 struct {
para135
ans135
}
// para 是参数
// one 代表第一个参数
type para135 struct {
ratings []int
}
// ans 是答案
// one 代表第一个答案
type ans135 struct {
one int
}
func Test_Problem135(t *testing.T) {
qs := []question135{
{
para135{[]int{1, 0, 2}},
ans135{5},
},
{
para135{[]int{1, 2, 2}},
ans135{4},
},
}
fmt.Printf("------------------------Leetcode Problem 135------------------------\n")
for _, q := range qs {
_, p := q.ans135, q.para135
fmt.Printf("【input】:%v 【output】:%v\n", p, candy(p.ratings))
}
fmt.Printf("\n\n\n")
}

View File

@ -0,0 +1,74 @@
# [135. Candy](https://leetcode.com/problems/candy/)
## 题目
There are `n` children standing in a line. Each child is assigned a rating value given in the integer array `ratings`.
You are giving candies to these children subjected to the following requirements:
- Each child must have at least one candy.
- Children with a higher rating get more candies than their neighbors.
Return *the minimum number of candies you need to have to distribute the candies to the children*.
**Example 1:**
```
Input: ratings = [1,0,2]
Output: 5
Explanation: You can allocate to the first, second and third child with 2, 1, 2 candies respectively.
```
**Example 2:**
```
Input: ratings = [1,2,2]
Output: 4
Explanation: You can allocate to the first, second and third child with 1, 2, 1 candies respectively.
The third child gets 1 candy because it satisfies the above two conditions.
```
**Constraints:**
- `n == ratings.length`
- `1 <= n <= 2 * 10^4`
- `0 <= ratings[i] <= 2 * 10^4`
## 题目大意
老师想给孩子们分发糖果,有 N 个孩子站成了一条直线老师会根据每个孩子的表现预先给他们评分。你需要按照以下要求帮助老师给这些孩子分发糖果
- 每个孩子至少分配到 1 个糖果。
- 评分更高的孩子必须比他两侧的邻位孩子获得更多的糖果。
那么这样下来,老师至少需要准备多少颗糖果呢?
## 解题思路
- 本题的突破口在于,评分更高的孩子必须比他两侧的邻位孩子获得更多的糖果,这句话。这个规则可以理解为 2 条规则,想象成按身高排队,站在下标为 0 的地方往后“看”,评分高即为个子高的,应该比前面个子矮(评分低)的分到糖果多;站在下标为 n - 1 的地方往后“看”,评分高即为个子高的,同样应该比前面个子矮(评分低)的分到糖果多。你可能会有疑问,规则都是一样的,为什么会出现至少需要多少糖果呢?因为可能出现评分一样高的同学。扫描数组两次,处理出每一个学生分别满足左规则或右规则时,最少需要被分得的糖果数量。每个人最终分得的糖果数量即为这两个数量的最大值。两次遍历结束,将所有糖果累加起来即为至少需要准备的糖果数。由于每个人至少分配到 1 个糖果,所以每个人糖果数再加一。
## 代码
```go
package leetcode
func candy(ratings []int) int {
candies := make([]int, len(ratings))
for i := 1; i < len(ratings); i++ {
if ratings[i] > ratings[i-1] {
candies[i] += candies[i-1] + 1
}
}
for i := len(ratings) - 2; i >= 0; i-- {
if ratings[i] > ratings[i+1] && candies[i] <= candies[i+1] {
candies[i] = candies[i+1] + 1
}
}
total := 0
for _, candy := range candies {
total += candy + 1
}
return total
}
```

View File

@ -26,4 +26,4 @@ Your algorithm should have a linear runtime complexity. Could you implement it w
## 解题思路
- 题目要求不能使用辅助空间,并且时间复杂度只能是线性的。
- 题目为什么要强调有一个数字出现一次其他的出现两次我们想到了异或运算的性质任何一个数字异或它自己都等于0。也就是说如果我们从头到尾依次异或数组中的每一个数字那么最终的结果刚好是那个只出现次的数字,因为那些出现两次的数字全部在异或中抵消掉了。于是最终做法是从头到尾依次异或数组中的每一个数字,那么最终得到的结果就是两个只出现一次的数字的异或结果。因为其他数字都出现了两次,在异或中全部抵消掉了。**利用的性质是 x^x = 0**。
- 题目为什么要强调有一个数字出现一次其他的出现两次我们想到了异或运算的性质任何一个数字异或它自己都等于0。也就是说如果我们从头到尾依次异或数组中的每一个数字那么最终的结果刚好是那个只出现次的数字,因为那些出现两次的数字全部在异或中抵消掉了。于是最终做法是从头到尾依次异或数组中的每一个数字,那么最终得到的结果就是两个只出现一次的数字的异或结果。因为其他数字都出现了两次,在异或中全部抵消掉了。**利用的性质是 x^x = 0**。

View File

@ -9,17 +9,16 @@ type ListNode = structures.ListNode
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
* type ListNode struct {
* Val int
* Next *ListNode
* }
*/
func hasCycle(head *ListNode) bool {
fast := head
slow := head
for slow != nil && fast != nil && fast.Next != nil {
for fast != nil && fast.Next != nil {
fast = fast.Next.Next
slow = slow.Next
if fast == slow {

View File

@ -1,6 +1,54 @@
package leetcode
import "testing"
import (
"fmt"
"testing"
"github.com/halfrost/LeetCode-Go/structures"
)
type question141 struct {
para141
ans141
}
// para 是参数
// one 代表第一个参数
type para141 struct {
one []int
}
// ans 是答案
// one 代表第一个答案
type ans141 struct {
one bool
}
func Test_Problem141(t *testing.T) {
qs := []question141{
{
para141{[]int{3, 2, 0, -4}},
ans141{false},
},
{
para141{[]int{1, 2}},
ans141{false},
},
{
para141{[]int{1}},
ans141{false},
},
}
fmt.Printf("------------------------Leetcode Problem 141------------------------\n")
for _, q := range qs {
_, p := q.ans141, q.para141
fmt.Printf("【input】:%v 【output】:%v\n", p, hasCycle(structures.Ints2List(p.one)))
}
fmt.Printf("\n\n\n")
}

View File

@ -31,4 +31,4 @@ Given 1->2->3->4->5, reorder it to 1->5->2->4->3.
更好的做法是结合之前几道题的操作:链表逆序,找中间结点。
先找到链表的中间结点,然后利用逆序区间的操作,如 [第 92 题](https://github.com/halfrost/LeetCode-Go/tree/master/leetcode/0092.Reverse-Linked-List-II) 里的 reverseBetween() 操作,只不过这里的反转区间是从中点一直到末尾。最后利用 2 个指针,一个指向头结点,一个指向中间结点,开始拼接最终的结果。这种做法的时间复杂度是 O(n),空间复杂度是 O(1)。
先找到链表的中间结点,然后利用逆序区间的操作,如 [第 92 题](https://github.com/halfrost/leetcode-go/tree/master/leetcode/0092.Reverse-Linked-List-II) 里的 reverseBetween() 操作,只不过这里的反转区间是从中点一直到末尾。最后利用 2 个指针,一个指向头结点,一个指向中间结点,开始拼接最终的结果。这种做法的时间复杂度是 O(n),空间复杂度是 O(1)。

View File

@ -1,8 +1,8 @@
package leetcode
import "fmt"
import (
"fmt"
"github.com/halfrost/LeetCode-Go/structures"
)

View File

@ -7,7 +7,7 @@ Given a positive integer, return its corresponding column title as appear in an
For example:
```
1 -> A
1 -> A
2 -> B
3 -> C
...

View File

@ -2,6 +2,7 @@ package leetcode
import (
"fmt"
"strconv"
"testing"
)
@ -23,7 +24,6 @@ type ans190 struct {
}
func Test_Problem190(t *testing.T) {
qs := []question190{
{
@ -41,7 +41,12 @@ func Test_Problem190(t *testing.T) {
for _, q := range qs {
_, p := q.ans190, q.para190
fmt.Printf("【input】:%v 【output】:%v\n", p, reverseBits(p.one))
input := strconv.FormatUint(uint64(p.one), 2) // 32位无符号整数转换为二进制字符串
input = fmt.Sprintf("%0*v", 32, input) // 格式化输出32位,保留前置0
output := reverseBits(p.one)
outputBin := strconv.FormatUint(uint64(output), 2) // 32位无符号整数转换为二进制字符串
outputBin = fmt.Sprintf("%0*v", 32, outputBin) // 格式化输出32位,保留前置0
fmt.Printf("【input】:%v 【output】:%v (%v)\n", input, output, outputBin)
}
fmt.Printf("\n\n\n")
}

View File

@ -2,6 +2,7 @@ package leetcode
import (
"fmt"
"strconv"
"testing"
)
@ -40,7 +41,9 @@ func Test_Problem191(t *testing.T) {
for _, q := range qs {
_, p := q.ans191, q.para191
fmt.Printf("【input】:%v 【output】:%v\n", p, hammingWeight(p.one))
input := strconv.FormatUint(uint64(p.one), 2) // 32位无符号整数转换为二进制字符串
input = fmt.Sprintf("%0*v", 32, input) // 格式化输出32位,保留前置0
fmt.Printf("【input】:%v 【output】:%v\n", input, hammingWeight(p.one))
}
fmt.Printf("\n\n\n")
}

View File

@ -1,27 +1,26 @@
package leetcode
func isHappy(n int) bool {
if n == 0 {
return false
}
res := 0
num := n
record := map[int]int{}
for {
for num != 0 {
res += (num % 10) * (num % 10)
num = num / 10
}
if _, ok := record[res]; !ok {
if res == 1 {
return true
for n != 1 {
record[n] = n
n = getSquareOfDigits(n)
for _, previous := range record {
if n == previous {
return false
}
record[res] = res
num = res
res = 0
continue
} else {
return false
}
}
return true
}
func getSquareOfDigits(n int) int {
squareOfDigits := 0
temporary := n
for temporary != 0 {
remainder := temporary % 10
squareOfDigits += remainder * remainder
temporary /= 10
}
return squareOfDigits
}

View File

@ -35,6 +35,16 @@ func Test_Problem202(t *testing.T) {
para202{19},
ans202{true},
},
{
para202{2},
ans202{false},
},
{
para202{3},
ans202{false},
},
}
fmt.Printf("------------------------Leetcode Problem 202------------------------\n")

View File

@ -29,5 +29,5 @@ You may assume k is always valid, 1 ≤ k ≤ array's length.
## 解题思路
在快的 partition 操作中,每次 partition 操作结束都会返回一个点,这个标定点的下标和最终排序之后有序数组中这个元素所在的下标是一致的。利用这个特性,我们可以不断的划分数组区间,最终找到第 K 大的元素。执行一次 partition 操作以后,如果这个元素的下标比 K 小,那么接着就在后边的区间继续执行 partition 操作;如果这个元素的下标比 K 大,那么就在左边的区间继续执行 partition 操作;如果相等就直接输出这个下标对应的数组元素即可。
在快速选择 quickselect 的 partition 操作中,每次 partition 操作结束都会返回一个点,这个标定点的下标和最终排序之后有序数组中这个元素所在的下标是一致的。利用这个特性,我们可以不断的划分数组区间,最终找到第 K 大的元素。执行一次 partition 操作以后,如果这个元素的下标比 K 小,那么接着就在后边的区间继续执行 partition 操作;如果这个元素的下标比 K 大,那么就在左边的区间继续执行 partition 操作;如果相等就直接输出这个下标对应的数组元素即可。

View File

@ -81,7 +81,7 @@ func (bit *BinaryIndexedTree) Query(index int) int {
return sum
}
// 解法 线段树 Segment Tree时间复杂度 O(n log n)
// 解法 线段树 Segment Tree时间复杂度 O(n log n)
func getSkyline1(buildings [][]int) [][]int {
st, ans, lastHeight, check := template.SegmentTree{}, [][]int{}, 0, false
posMap, pos := discretization218(buildings)

View File

@ -15,8 +15,26 @@ type ListNode = structures.ListNode
* }
*/
// 解法一
func isPalindrome(head *ListNode) bool {
slice := []int{}
for head != nil {
slice = append(slice, head.Val)
head = head.Next
}
for i, j := 0, len(slice)-1; i < j; {
if slice[i] != slice[j] {
return false
}
i++
j--
}
return true
}
// 解法二
// 此题和 143 题 Reorder List 思路基本一致
func isPalindrome234(head *ListNode) bool {
func isPalindrome1(head *ListNode) bool {
if head == nil || head.Next == nil {
return true
}
@ -28,7 +46,6 @@ func isPalindrome234(head *ListNode) bool {
p1 = p1.Next
p2 = p2.Next.Next
}
// 反转链表后半部分 1->2->3->4->5->6 to 1->2->3->6->5->4
preMiddle := p1
preCurrent := p1.Next
@ -38,7 +55,6 @@ func isPalindrome234(head *ListNode) bool {
current.Next = preMiddle.Next
preMiddle.Next = current
}
// 扫描表,判断是否是回文
p1 = head
p2 = preMiddle.Next
@ -59,18 +75,15 @@ func isPalindrome234(head *ListNode) bool {
return false
}
}
return res
}
// L2ss define
func L2ss(head *ListNode) []int {
res := []int{}
for head != nil {
res = append(res, head.Val)
head = head.Next
}
return res
}

View File

@ -83,7 +83,7 @@ func Test_Problem234(t *testing.T) {
for _, q := range qs {
_, p := q.ans234, q.para234
fmt.Printf("【input】:%v 【output】:%v\n", p, isPalindrome234(structures.Ints2List(p.one)))
fmt.Printf("【input】:%v 【output】:%v\n", p, isPalindrome(structures.Ints2List(p.one)))
}
fmt.Printf("\n\n\n")
}

View File

@ -15,14 +15,6 @@ type ListNode = structures.ListNode
* }
*/
func deleteNode(node *ListNode) {
if node == nil {
return
}
cur := node
for cur.Next.Next != nil {
cur.Val = cur.Next.Val
cur = cur.Next
}
cur.Val = cur.Next.Val
cur.Next = nil
node.Val = node.Next.Val
node.Next = node.Next.Next
}

View File

@ -1,35 +1,64 @@
# [237. Delete Node in a Linked List](https://leetcode.com/problems/delete-node-in-a-linked-list/)
## 题目
Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.
Write a function to **delete a node** in a singly-linked list. You will **not** be given access to the `head` of the list, instead you will be given access to **the node to be deleted** directly.
Given linked list -- head = [4,5,1,9], which looks like following:
It is **guaranteed** that the node to be deleted is **not a tail node** in the list.
![](https://assets.leetcode.com/uploads/2018/12/28/237_example.png)
**Example 1:**
Example 1:
![https://assets.leetcode.com/uploads/2020/09/01/node1.jpg](https://assets.leetcode.com/uploads/2020/09/01/node1.jpg)
```c
```
Input: head = [4,5,1,9], node = 5
Output: [4,1,9]
Explanation: You are given the second node with value 5, the linked list should become 4 -> 1 -> 9 after calling your function.
Explanation:You are given the second node with value 5, the linked list should become 4 -> 1 -> 9 after calling your function.
```
Example 2:
**Example 2:**
```c
![https://assets.leetcode.com/uploads/2020/09/01/node2.jpg](https://assets.leetcode.com/uploads/2020/09/01/node2.jpg)
```
Input: head = [4,5,1,9], node = 1
Output: [4,5,9]
Explanation: You are given the third node with value 1, the linked list should become 4 -> 5 -> 9 after calling your function.
Explanation:You are given the third node with value 1, the linked list should become 4 -> 5 -> 9 after calling your function.
```
Note:
**Example 3:**
- The linked list will have at least two elements.
- All of the nodes' values will be unique.
- The given node will not be the tail and it will always be a valid node of the linked list.
- Do not return anything from your function.
```
Input: head = [1,2,3,4], node = 3
Output: [1,2,4]
```
**Example 4:**
```
Input: head = [0,1], node = 0
Output: [1]
```
**Example 5:**
```
Input: head = [-3,5,-99], node = -3
Output: [5,-99]
```
**Constraints:**
- The number of the nodes in the given list is in the range `[2, 1000]`.
- `1000 <= Node.val <= 1000`
- The value of each node in the list is **unique**.
- The `node` to be deleted is **in the list** and is **not a tail** node
## 题目大意
@ -37,4 +66,29 @@ Note:
## 解题思路
其实就是把后面的结点都覆盖上来即可。或者直接当前结点的值等于下一个结点Next 指针指向下下个结点,这样做也可以,只不过中间有一个结点不被释放,内存消耗多一些。
其实就是把后面的结点都覆盖上来即可。或者直接当前结点的值等于下一个结点Next 指针指向下下个结点,这样做也可以,只不过中间有一个结点不被释放,内存消耗多一些。
## 代码
```go
package leetcode
import (
"github.com/halfrost/LeetCode-Go/structures"
)
// ListNode define
type ListNode = structures.ListNode
/**
* Definition for singly-linked list.
* type ListNode struct {
* Val int
* Next *ListNode
* }
*/
func deleteNode(node *ListNode) {
node.Val = node.Next.Val
node.Next = node.Next.Next
}
```

View File

@ -24,44 +24,17 @@ func isAnagram(s string, t string) bool {
// 解法二
func isAnagram1(s string, t string) bool {
if s == "" && t == "" {
return true
hash := map[rune]int{}
for _, value := range s {
hash[value]++
}
if s == "" || t == "" {
return false
for _, value := range t {
hash[value]--
}
sBytes := []byte(s)
tBytes := []byte(t)
if len(sBytes) != len(tBytes) {
return false
}
quickSortByte(sBytes, 0, len(sBytes)-1)
quickSortByte(tBytes, 0, len(tBytes)-1)
for i := 0; i < len(sBytes); i++ {
if sBytes[i] != tBytes[i] {
for _, value := range hash {
if value != 0 {
return false
}
}
return true
}
func partitionByte(a []byte, lo, hi int) int {
pivot := a[hi]
i := lo - 1
for j := lo; j < hi; j++ {
if a[j] > pivot {
i++
a[j], a[i] = a[i], a[j]
}
}
a[i+1], a[hi] = a[hi], a[i+1]
return i + 1
}
func quickSortByte(a []byte, lo, hi int) {
if lo >= hi {
return
}
p := partitionByte(a, lo, hi)
quickSortByte(a, lo, p-1)
quickSortByte(a, p+1, hi)
}

View File

@ -45,6 +45,21 @@ func Test_Problem242(t *testing.T) {
para242{"rat", "car"},
ans242{false},
},
{
para242{"a", "ab"},
ans242{false},
},
{
para242{"ab", "a"},
ans242{false},
},
{
para242{"aa", "bb"},
ans242{false},
},
}
fmt.Printf("------------------------Leetcode Problem 242------------------------\n")

View File

@ -2,9 +2,7 @@ package leetcode
import (
"strconv"
)
import (
"github.com/halfrost/LeetCode-Go/structures"
)

View File

@ -31,12 +31,12 @@ func Test_Problem297(t *testing.T) {
ans297{[]int{}},
},
{
para297{[]int{1,2,3,-1,-1,4,5}},
ans297{[]int{1,2,3,-1,-1,4,5}},
para297{[]int{1, 2, 3, -1, -1, 4, 5}},
ans297{[]int{1, 2, 3, -1, -1, 4, 5}},
},
{
para297{[]int{1,2}},
ans297{[]int{1,2}},
para297{[]int{1, 2}},
ans297{[]int{1, 2}},
},
}
@ -52,4 +52,4 @@ func Test_Problem297(t *testing.T) {
fmt.Printf("【output】:%v \n", structures.Tree2Preorder(tree297.deserialize(serialized)))
}
fmt.Printf("\n\n\n")
}
}

View File

@ -0,0 +1,31 @@
package leetcode
import "strconv"
func getHint(secret string, guess string) string {
cntA, cntB := 0, 0
mpS := make(map[byte]int)
var strG []byte
n := len(secret)
var ans string
for i := 0; i < n; i++ {
if secret[i] == guess[i] {
cntA++
} else {
mpS[secret[i]] += 1
strG = append(strG, guess[i])
}
}
for _, v := range strG {
if _, ok := mpS[v]; ok {
if mpS[v] > 1 {
mpS[v] -= 1
} else {
delete(mpS, v)
}
cntB++
}
}
ans += strconv.Itoa(cntA) + "A" + strconv.Itoa(cntB) + "B"
return ans
}

View File

@ -0,0 +1,56 @@
package leetcode
import (
"fmt"
"testing"
)
type question299 struct {
para299
ans299
}
// para 是参数
type para299 struct {
secret string
guess string
}
// ans 是答案
type ans299 struct {
ans string
}
func Test_Problem299(t *testing.T) {
qs := []question299{
{
para299{"1807", "7810"},
ans299{"1A3B"},
},
{
para299{"1123", "0111"},
ans299{"1A1B"},
},
{
para299{"1", "0"},
ans299{"0A0B"},
},
{
para299{"1", "1"},
ans299{"1A0B"},
},
}
fmt.Printf("------------------------Leetcode Problem 299------------------------\n")
for _, q := range qs {
_, p := q.ans299, q.para299
fmt.Printf("【input】:%v 【output】:%v\n", p, getHint(p.secret, p.guess))
}
fmt.Printf("\n\n\n")
}

View File

@ -0,0 +1,114 @@
# [299. Bulls and Cows](https://leetcode.com/problems/bulls-and-cows/)
## 题目
You are playing the Bulls and Cows game with your friend.
You write down a secret number and ask your friend to guess what the number is. When your friend makes a guess, you provide a hint with the following info:
The number of "bulls", which are digits in the guess that are in the correct position.
The number of "cows", which are digits in the guess that are in your secret number but are located in the wrong position. Specifically, the non-bull digits in the guess that could be rearranged such that they become bulls.
Given the secret number secret and your friend's guess guess, return the hint for your friend's guess.
The hint should be formatted as "xAyB", where x is the number of bulls and y is the number of cows. Note that both secret and guess may contain duplicate digits.
**Example 1:**
```
Input: secret = "1807", guess = "7810"
Output: "1A3B"
Explanation: Bulls are connected with a '|' and cows are underlined:
"1807"
|
"7810"
```
**Example 2:**
```
Input: secret = "1123", guess = "0111"
Output: "1A1B"
Explanation: Bulls are connected with a '|' and cows are underlined:
"1123" "1123"
| or |
"0111" "0111"
Note that only one of the two unmatched 1s is counted as a cow since the non-bull digits can only be rearranged to allow one 1 to be a bull.
```
**Example 3:**
```
Input: secret = "1", guess = "0"
Output: "0A0B"
```
**Example 4:**
```
Input: secret = "1", guess = "1"
Output: "1A0B"
```
**Constraints:**
- 1 <= secret.length, guess.length <= 1000
- secret.length == guess.length
- secret and guess consist of digits only.
## 题目大意
你在和朋友一起玩 猜数字Bulls and Cows游戏该游戏规则如下
写出一个秘密数字,并请朋友猜这个数字是多少。朋友每猜测一次,你就会给他一个包含下述信息的提示:
猜测数字中有多少位属于数字和确切位置都猜对了(称为 "Bulls", 公牛),
有多少位属于数字猜对了但是位置不对(称为 "Cows", 奶牛)。也就是说,这次猜测中有多少位非公牛数字可以通过重新排列转换成公牛数字。
给你一个秘密数字secret 和朋友猜测的数字guess ,请你返回对朋友这次猜测的提示。
提示的格式为 "xAyB" x 是公牛个数, y 是奶牛个数A 表示公牛B表示奶牛。
请注意秘密数字和朋友猜测的数字都可能含有重复数字。
## 解题思路
- 计算下标一致并且对应下标的元素一致的个数,即 x
- secret 和 guess 分别去除 x 个公牛的元素,剩下 secret 和 guess 求共同的元素个数就是 y
- 把 x y 转换成字符串,分别与 "A" 和 "B" 进行拼接返回结果
## 代码
```go
package leetcode
import "strconv"
func getHint(secret string, guess string) string {
cntA, cntB := 0, 0
mpS := make(map[byte]int)
var strG []byte
n := len(secret)
var ans string
for i := 0; i < n; i++ {
if secret[i] == guess[i] {
cntA++
} else {
mpS[secret[i]] += 1
strG = append(strG, guess[i])
}
}
for _, v := range strG {
if _, ok := mpS[v]; ok {
if mpS[v] > 1 {
mpS[v] -= 1
} else {
delete(mpS, v)
}
cntB++
}
}
ans += strconv.Itoa(cntA) + "A" + strconv.Itoa(cntB) + "B"
return ans
}
```

View File

@ -0,0 +1,69 @@
package leetcode
var (
res []string
mp map[string]int
n int
length int
maxScore int
str string
)
func removeInvalidParentheses(s string) []string {
lmoves, rmoves, lcnt, rcnt := 0, 0, 0, 0
for _, v := range s {
if v == '(' {
lmoves++
lcnt++
} else if v == ')' {
if lmoves != 0 {
lmoves--
} else {
rmoves++
}
rcnt++
}
}
n = len(s)
length = n - lmoves - rmoves
res = []string{}
mp = make(map[string]int)
maxScore = min(lcnt, rcnt)
str = s
backtrace(0, "", lmoves, rmoves, 0)
return res
}
func backtrace(i int, cur string, lmoves int, rmoves int, score int) {
if lmoves < 0 || rmoves < 0 || score < 0 || score > maxScore {
return
}
if lmoves == 0 && rmoves == 0 {
if len(cur) == length {
if _, ok := mp[cur]; !ok {
res = append(res, cur)
mp[cur] = 1
}
return
}
}
if i == n {
return
}
if str[i] == '(' {
backtrace(i+1, cur+string('('), lmoves, rmoves, score+1)
backtrace(i+1, cur, lmoves-1, rmoves, score)
} else if str[i] == ')' {
backtrace(i+1, cur+string(')'), lmoves, rmoves, score-1)
backtrace(i+1, cur, lmoves, rmoves-1, score)
} else {
backtrace(i+1, cur+string(str[i]), lmoves, rmoves, score)
}
}
func min(a, b int) int {
if a < b {
return a
}
return b
}

View File

@ -0,0 +1,50 @@
package leetcode
import (
"fmt"
"testing"
)
type question301 struct {
para301
ans301
}
// s 是参数
type para301 struct {
s string
}
// ans 是答案
type ans301 struct {
ans []string
}
func Test_Problem301(t *testing.T) {
qs := []question301{
{
para301{"()())()"},
ans301{[]string{"(())()", "()()()"}},
},
{
para301{"(a)())()"},
ans301{[]string{"(a())()", "(a)()()"}},
},
{
para301{")("},
ans301{[]string{""}},
},
}
fmt.Printf("------------------------Leetcode Problem 301------------------------\n")
for _, q := range qs {
_, p := q.ans301, q.para301
fmt.Printf("【input】:%v 【output】:%v\n", p, removeInvalidParentheses(p.s))
}
fmt.Printf("\n\n\n")
}

View File

@ -0,0 +1,131 @@
# [301. Remove Invalid Parentheses](https://leetcode.com/problems/remove-invalid-parentheses/)
## 题目
Given a string s that contains parentheses and letters, remove the minimum number of invalid parentheses to make the input string valid.
Return all the possible results. You may return the answer in any order.
**Example 1:**
Input: s = "()())()"
Output: ["(())()","()()()"]
**Example 2:**
Input: s = "(a)())()"
Output: ["(a())()","(a)()()"]
**Example 3:**
Input: s = ")("
Output: [""]
**Constraints:**
- 1 <= s.length <= 25
- s consists of lowercase English letters and parentheses '(' and ')'.
- There will be at most 20 parentheses in s.
## 题目大意
给你一个由若干括号和字母组成的字符串 s ,删除最小数量的无效括号,使得输入的字符串有效。
返回所有可能的结果。答案可以按 任意顺序 返回。
说明:
- 1 <= s.length <= 25
- s 由小写英文字母以及括号 '(' 和 ')' 组成
- s 中至多含 20 个括号
## 解题思路
回溯和剪枝
- 计算最大得分数maxScore合法字符串的长度length左括号和右括号的移除次数lmoves,rmoves
- 加一个左括号的得分加1加一个右括号的得分减1
- 对于一个合法的字符串左括号等于右括号得分最终为0
- 搜索过程中出现以下任何一种情况都直接返回
- 得分值为负数
- 得分大于最大得分数
- 得分小于0
- lmoves小于0
- rmoves小于0
## 代码
```go
package leetcode
var (
res []string
mp map[string]int
n int
length int
maxScore int
str string
)
func removeInvalidParentheses(s string) []string {
lmoves, rmoves, lcnt, rcnt := 0, 0, 0, 0
for _, v := range s {
if v == '(' {
lmoves++
lcnt++
} else if v == ')' {
if lmoves != 0 {
lmoves--
} else {
rmoves++
}
rcnt++
}
}
n = len(s)
length = n - lmoves - rmoves
res = []string{}
mp = make(map[string]int)
maxScore = min(lcnt, rcnt)
str = s
backtrace(0, "", lmoves, rmoves, 0)
return res
}
func backtrace(i int, cur string, lmoves int, rmoves int, score int) {
if lmoves < 0 || rmoves < 0 || score < 0 || score > maxScore {
return
}
if lmoves == 0 && rmoves == 0 {
if len(cur) == length {
if _, ok := mp[cur]; !ok {
res = append(res, cur)
mp[cur] = 1
}
return
}
}
if i == n {
return
}
if str[i] == '(' {
backtrace(i+1, cur+string('('), lmoves, rmoves, score+1)
backtrace(i+1, cur, lmoves-1, rmoves, score)
} else if str[i] == ')' {
backtrace(i+1, cur+string(')'), lmoves, rmoves, score-1)
backtrace(i+1, cur, lmoves, rmoves-1, score)
} else {
backtrace(i+1, cur+string(str[i]), lmoves, rmoves, score)
}
}
func min(a, b int) int {
if a < b {
return a
}
return b
}
```

View File

@ -35,7 +35,7 @@ func max(a int, b int) int {
return b
}
//Propagate for rest of the string
// Propagate for rest of the string
func recursiveCheck(num string, x1 int, x2 int, left int) bool {
if left == len(num) {
return true

View File

@ -0,0 +1,7 @@
package leetcode
import "math"
func bulbSwitch(n int) int {
return int(math.Sqrt(float64(n)))
}

View File

@ -0,0 +1,50 @@
package leetcode
import (
"fmt"
"testing"
)
type question319 struct {
para319
ans319
}
// para 是参数
type para319 struct {
n int
}
// ans 是答案
type ans319 struct {
ans int
}
func Test_Problem319(t *testing.T) {
qs := []question319{
{
para319{3},
ans319{1},
},
{
para319{0},
ans319{0},
},
{
para319{1},
ans319{1},
},
}
fmt.Printf("------------------------Leetcode Problem 319------------------------\n")
for _, q := range qs {
_, p := q.ans319, q.para319
fmt.Printf("【input】:%v 【output】:%v\n", p, bulbSwitch(p.n))
}
fmt.Printf("\n\n\n")
}

View File

@ -0,0 +1,58 @@
# [319. Bulb Switcher](https://leetcode.com/problems/bulb-switcher/)
## 题目
There are n bulbs that are initially off. You first turn on all the bulbs, then you turn off every second bulb.
On the third round, you toggle every third bulb (turning on if it's off or turning off if it's on). For the ith round, you toggle every i bulb. For the nth round, you only toggle the last bulb.
Return the number of bulbs that are on after n rounds.
**Example 1:**
Input: n = 3
Output: 1
Explanation: At first, the three bulbs are [off, off, off].
After the first round, the three bulbs are [on, on, on].
After the second round, the three bulbs are [on, off, on].
After the third round, the three bulbs are [on, off, off].
So you should return 1 because there is only one bulb is on.
**Example 2:**
Input: n = 0
Output: 0
**Example 3:**
Input: n = 1
Output: 1
## 题目大意
初始时有 n 个灯泡处于关闭状态。第一轮,你将会打开所有灯泡。接下来的第二轮,你将会每两个灯泡关闭一个。
第三轮,你每三个灯泡就切换一个灯泡的开关(即,打开变关闭,关闭变打开)。第 i 轮,你每 i 个灯泡就切换一个灯泡的开关。直到第 n 轮,你只需要切换最后一个灯泡的开关。
找出并返回 n 轮后有多少个亮着的灯泡。
## 解题思路
- 计算 1 到 n 中有奇数个约数的个数
- 1 到 n 中的某个数 x 有奇数个约数,也即 x 是完全平方数
- 计算 1 到 n 中完全平方数的个数 sqrt(n)
## 代码
```go
package leetcode
import "math"
func bulbSwitch(n int) int {
return int(math.Sqrt(float64(n)))
}
```

View File

@ -31,4 +31,4 @@ Note:
## 解题思路
这道题思路也是一样的,分别把奇数和偶数都放在 2 个链表中,最后首尾拼接就是答案。
这道题思路也是一样的,分别把奇数节点和偶数节点都放在 2 个链表中,最后首尾拼接就是答案。

View File

@ -0,0 +1,49 @@
package leetcode
import "sort"
type SummaryRanges struct {
nums []int
mp map[int]int
}
func Constructor() SummaryRanges {
return SummaryRanges{
nums: []int{},
mp: map[int]int{},
}
}
func (this *SummaryRanges) AddNum(val int) {
if _, ok := this.mp[val]; !ok {
this.mp[val] = 1
this.nums = append(this.nums, val)
}
sort.Ints(this.nums)
}
func (this *SummaryRanges) GetIntervals() [][]int {
n := len(this.nums)
var ans [][]int
if n == 0 {
return ans
}
if n == 1 {
ans = append(ans, []int{this.nums[0], this.nums[0]})
return ans
}
start, end := this.nums[0], this.nums[0]
ans = append(ans, []int{start, end})
index := 0
for i := 1; i < n; i++ {
if this.nums[i] == end+1 {
end = this.nums[i]
ans[index][1] = end
} else {
start, end = this.nums[i], this.nums[i]
ans = append(ans, []int{start, end})
index++
}
}
return ans
}

View File

@ -0,0 +1,63 @@
package leetcode
import (
"fmt"
"testing"
)
type question352 struct {
para352
ans352
}
// para 是参数
type para352 struct {
para string
num int
}
// ans 是答案
type ans352 struct {
ans [][]int
}
func Test_Problem352(t *testing.T) {
qs := []question352{
{
para352{"addNum", 1},
ans352{[][]int{{1, 1}}},
},
{
para352{"addNum", 3},
ans352{[][]int{{1, 1}, {3, 3}}},
},
{
para352{"addNum", 7},
ans352{[][]int{{1, 1}, {3, 3}, {7, 7}}},
},
{
para352{"addNum", 2},
ans352{[][]int{{1, 3}, {7, 7}}},
},
{
para352{"addNum", 6},
ans352{[][]int{{1, 3}, {6, 7}}},
},
}
fmt.Printf("------------------------Leetcode Problem 352------------------------\n")
obj := Constructor()
for _, q := range qs {
_, p := q.ans352, q.para352
obj.AddNum(p.num)
fmt.Printf("【input】:%v 【output】:%v\n", p, obj.GetIntervals())
}
fmt.Printf("\n\n\n")
}

View File

@ -0,0 +1,108 @@
# [352. Data Stream as Disjoint Intervals](https://leetcode.com/problems/data-stream-as-disjoint-intervals/)
## 题目
Given a data stream input of non-negative integers a1, a2, ..., an, summarize the numbers seen so far as a list of disjoint intervals.
Implement the SummaryRanges class:
- SummaryRanges() Initializes the object with an empty stream.
- void addNum(int val) Adds the integer val to the stream.
- int[][] getIntervals() Returns a summary of the integers in the stream currently as a list of disjoint intervals [starti, endi].
**Example 1:**
Input
["SummaryRanges", "addNum", "getIntervals", "addNum", "getIntervals", "addNum", "getIntervals", "addNum", "getIntervals", "addNum", "getIntervals"]
[[], [1], [], [3], [], [7], [], [2], [], [6], []]
Output
[null, null, [[1, 1]], null, [[1, 1], [3, 3]], null, [[1, 1], [3, 3], [7, 7]], null, [[1, 3], [7, 7]], null, [[1, 3], [6, 7]]]
Explanation
SummaryRanges summaryRanges = new SummaryRanges();
summaryRanges.addNum(1); // arr = [1]
summaryRanges.getIntervals(); // return [[1, 1]]
summaryRanges.addNum(3); // arr = [1, 3]
summaryRanges.getIntervals(); // return [[1, 1], [3, 3]]
summaryRanges.addNum(7); // arr = [1, 3, 7]
summaryRanges.getIntervals(); // return [[1, 1], [3, 3], [7, 7]]
summaryRanges.addNum(2); // arr = [1, 2, 3, 7]
summaryRanges.getIntervals(); // return [[1, 3], [7, 7]]
summaryRanges.addNum(6); // arr = [1, 2, 3, 6, 7]
summaryRanges.getIntervals(); // return [[1, 3], [6, 7]]
**Constraints**
- 0 <= val <= 10000
- At most 3 * 10000 calls will be made to addNum and getIntervals.
## 题目大意
给你一个由非负整数a1, a2, ..., an 组成的数据流输入,请你将到目前为止看到的数字总结为不相交的区间列表。
实现 SummaryRanges 类:
- SummaryRanges() 使用一个空数据流初始化对象。
- void addNum(int val) 向数据流中加入整数 val 。
- int[][] getIntervals() 以不相交区间[starti, endi] 的列表形式返回对数据流中整数的总结
## 解题思路
- 使用字典过滤掉重复的数字
- 把过滤后的数字放到nums中,并进行排序
- 使用nums构建不重复的区间
## 代码
```go
package leetcode
import "sort"
type SummaryRanges struct {
nums []int
mp map[int]int
}
func Constructor() SummaryRanges {
return SummaryRanges{
nums: []int{},
mp : map[int]int{},
}
}
func (this *SummaryRanges) AddNum(val int) {
if _, ok := this.mp[val]; !ok {
this.mp[val] = 1
this.nums = append(this.nums, val)
}
sort.Ints(this.nums)
}
func (this *SummaryRanges) GetIntervals() [][]int {
n := len(this.nums)
var ans [][]int
if n == 0 {
return ans
}
if n == 1 {
ans = append(ans, []int{this.nums[0], this.nums[0]})
return ans
}
start, end := this.nums[0], this.nums[0]
ans = append(ans, []int{start, end})
index := 0
for i := 1; i < n; i++ {
if this.nums[i] == end + 1 {
end = this.nums[i]
ans[index][1] = end
} else {
start, end = this.nums[i], this.nums[i]
ans = append(ans, []int{start, end})
index++
}
}
return ans
}
```

View File

@ -8,10 +8,11 @@ package leetcode
// 模运算性质五ab % p = ((a % p) * ( b % p)) % p, 其中 ab 是一个数字,如:287498374 等等
// 举个例子
// 12345^678 % 1337 = (12345^670 * 12345^8) % 1337
// = ((12345^670 % 1337) * (12345^8 % 1337)) % 1337 ---> 利用性质 三
//
// = ((12345^670 % 1337) * (12345^8 % 1337)) % 1337 ---> 利用性质 三
// = (((12345^67)^10 % 1337) * (12345^8 % 1337)) % 1337 ---> 乘方性质
// = ((12345^67 % 1337)^10) % 1337 * (12345^8 % 1337)) % 1337 ---> 利用性质 四
// = (((12345^67 % 1337)^10) * (12345^8 % 1337)) % 1337 ---> 反向利用性质 三
// = ((12345^67 % 1337)^10) % 1337 * (12345^8 % 1337)) % 1337 ---> 利用性质 四
// = (((12345^67 % 1337)^10) * (12345^8 % 1337)) % 1337 ---> 反向利用性质 三
func superPow(a int, b []int) int {
res := 1
for i := 0; i < len(b); i++ {

View File

@ -0,0 +1,48 @@
package leetcode
import (
"math/rand"
"github.com/halfrost/LeetCode-Go/structures"
)
// ListNode define
type ListNode = structures.ListNode
/**
* Definition for singly-linked list.
* type ListNode struct {
* Val int
* Next *ListNode
* }
*/
type Solution struct {
head *ListNode
}
/*
- @param head The linked list's head.
Note that the head is guaranteed to be not null, so it contains at least one node.
*/
func Constructor(head *ListNode) Solution {
return Solution{head: head}
}
/** Returns a random node's value. */
func (this *Solution) GetRandom() int {
scope, selectPoint, curr := 1, 0, this.head
for curr != nil {
if rand.Float64() < 1.0/float64(scope) {
selectPoint = curr.Val
}
scope += 1
curr = curr.Next
}
return selectPoint
}
/**
* Your Solution object will be instantiated and called as such:
* obj := Constructor(head);
* param_1 := obj.GetRandom();
*/

View File

@ -0,0 +1,28 @@
package leetcode
import (
"fmt"
"testing"
"github.com/halfrost/LeetCode-Go/structures"
)
func Test_Problem382(t *testing.T) {
header := structures.Ints2List([]int{1, 2, 3, 4, 5, 6, 7, 8, 9, 0})
obj := Constructor(header)
fmt.Printf("obj = %v\n", structures.List2Ints(header))
param1 := obj.GetRandom()
fmt.Printf("param_1 = %v\n", param1)
param1 = obj.GetRandom()
fmt.Printf("param_1 = %v\n", param1)
param1 = obj.GetRandom()
fmt.Printf("param_1 = %v\n", param1)
param1 = obj.GetRandom()
fmt.Printf("param_1 = %v\n", param1)
param1 = obj.GetRandom()
fmt.Printf("param_1 = %v\n", param1)
param1 = obj.GetRandom()
fmt.Printf("param_1 = %v\n", param1)
fmt.Printf("\n\n\n")
}

View File

@ -0,0 +1,105 @@
# [382. Linked List Random Node](https://leetcode.com/problems/linked-list-random-node/)
## 题目
Given a singly linked list, return a random node's value from the linked list. Each node must have the **same probability** of being chosen.
Implement the `Solution` class:
- `Solution(ListNode head)` Initializes the object with the integer array nums.
- `int getRandom()` Chooses a node randomly from the list and returns its value. All the nodes of the list should be equally likely to be choosen.
**Example 1:**
![https://assets.leetcode.com/uploads/2021/03/16/getrand-linked-list.jpg](https://assets.leetcode.com/uploads/2021/03/16/getrand-linked-list.jpg)
```
Input
["Solution", "getRandom", "getRandom", "getRandom", "getRandom", "getRandom"]
[[[1, 2, 3]], [], [], [], [], []]
Output
[null, 1, 3, 2, 2, 3]
Explanation
Solution solution = new Solution([1, 2, 3]);
solution.getRandom(); // return 1
solution.getRandom(); // return 3
solution.getRandom(); // return 2
solution.getRandom(); // return 2
solution.getRandom(); // return 3
// getRandom() should return either 1, 2, or 3 randomly. Each element should have equal probability of returning.
```
**Constraints:**
- The number of nodes in the linked list will be in the range `[1, 104]`.
- `-10^4 <= Node.val <= 10^4`
- At most `10^4` calls will be made to `getRandom`.
**Follow up:**
- What if the linked list is extremely large and its length is unknown to you?
- Could you solve this efficiently without using extra space?
## 题目大意
给定一个单链表,随机选择链表的一个节点,并返回相应的节点值。保证每个节点被选的概率一样。
进阶: 如果链表十分大且长度未知,如何解决这个问题?你能否使用常数级空间复杂度实现?
## 解题思路
- rand.Float64() 可以返回 [0.0,1.0) 之间的随机数。利用这个函数完成我们的随机化取节点的过程。
## 代码
```go
package leetcode
import (
"math/rand"
"github.com/halfrost/LeetCode-Go/structures"
)
// ListNode define
type ListNode = structures.ListNode
/**
* Definition for singly-linked list.
* type ListNode struct {
* Val int
* Next *ListNode
* }
*/
type Solution struct {
head *ListNode
}
/** @param head The linked list's head.
Note that the head is guaranteed to be not null, so it contains at least one node. */
func Constructor(head *ListNode) Solution {
return Solution{head: head}
}
/** Returns a random node's value. */
func (this *Solution) GetRandom() int {
scope, selectPoint, curr := 1, 0, this.head
for curr != nil {
if rand.Float64() < 1.0/float64(scope) {
selectPoint = curr.Val
}
scope += 1
curr = curr.Next
}
return selectPoint
}
/**
* Your Solution object will be instantiated and called as such:
* obj := Constructor(head);
* param_1 := obj.GetRandom();
*/
```

View File

@ -0,0 +1,18 @@
package leetcode
func canConstruct(ransomNote string, magazine string) bool {
if len(ransomNote) > len(magazine) {
return false
}
var cnt [26]int
for _, v := range magazine {
cnt[v-'a']++
}
for _, v := range ransomNote {
cnt[v-'a']--
if cnt[v-'a'] < 0 {
return false
}
}
return true
}

View File

@ -0,0 +1,51 @@
package leetcode
import (
"fmt"
"testing"
)
type question383 struct {
para383
ans383
}
// para 是参数
type para383 struct {
ransomNote string
magazine string
}
// ans 是答案
type ans383 struct {
ans bool
}
func Test_Problem383(t *testing.T) {
qs := []question383{
{
para383{"a", "b"},
ans383{false},
},
{
para383{"aa", "ab"},
ans383{false},
},
{
para383{"aa", "aab"},
ans383{true},
},
}
fmt.Printf("------------------------Leetcode Problem 383------------------------\n")
for _, q := range qs {
_, p := q.ans383, q.para383
fmt.Printf("【input】:%v 【output】:%v\n", p, canConstruct(p.ransomNote, p.magazine))
}
fmt.Printf("\n\n\n")
}

View File

@ -0,0 +1,64 @@
# [383. Ransom Note](https://leetcode.com/problems/ransom-note/)
## 题目
Given two stings ransomNote and magazine, return true if ransomNote can be constructed from magazine and false otherwise.
Each letter in magazine can only be used once in ransomNote.
**Example 1**:
Input: ransomNote = "a", magazine = "b"
Output: false
**Example 2**:
Input: ransomNote = "aa", magazine = "ab"
Output: false
**Example 3**:
Input: ransomNote = "aa", magazine = "aab"
Output: true
**Constraints:**
- 1 <= ransomNote.length, magazine.length <= 100000
- ransomNote and magazine consist of lowercase English letters.
## 题目大意
为了不在赎金信中暴露字迹,从杂志上搜索各个需要的字母,组成单词来表达意思。
给你一个赎金信 (ransomNote) 字符串和一个杂志(magazine)字符串,判断 ransomNote 能不能由 magazines 里面的字符构成。
如果可以构成,返回 true ;否则返回 false 。
magazine 中的每个字符只能在 ransomNote 中使用一次。
## 解题思路
- ransomNote 和 magazine 都是由小写字母组成,所以用数组进行简单的字符统计
## 代码
````go
package leetcode
func canConstruct(ransomNote string, magazine string) bool {
if len(ransomNote) > len(magazine) {
return false
}
var cnt [26]int
for _, v := range magazine {
cnt[v-'a']++
}
for _, v := range ransomNote {
cnt[v-'a']--
if cnt[v-'a'] < 0 {
return false
}
}
return true
}
````

View File

@ -0,0 +1,28 @@
package leetcode
import "math/rand"
type Solution struct {
nums []int
}
func Constructor(nums []int) Solution {
return Solution{
nums: nums,
}
}
/** Resets the array to its original configuration and return it. */
func (this *Solution) Reset() []int {
return this.nums
}
/** Returns a random shuffling of the array. */
func (this *Solution) Shuffle() []int {
arr := make([]int, len(this.nums))
copy(arr, this.nums)
rand.Shuffle(len(arr), func(i, j int) {
arr[i], arr[j] = arr[j], arr[i]
})
return arr
}

View File

@ -0,0 +1,50 @@
package leetcode
import (
"fmt"
"testing"
)
type question384 struct {
para384
ans384
}
// para 是参数
type para384 struct {
ops []string
value [][]int
}
// ans 是答案
type ans384 struct {
ans [][]int
}
func Test_Problem384(t *testing.T) {
qs := []question384{
{
para384{ops: []string{"Solution", "shuffle", "reset", "shuffle"}, value: [][]int{{1, 2, 3}, {}, {}, {}}},
ans384{[][]int{nil, {3, 1, 2}, {1, 2, 3}, {1, 3, 2}}},
},
}
fmt.Printf("------------------------Leetcode Problem 384------------------------\n")
for _, q := range qs {
sol := Constructor(nil)
_, p := q.ans384, q.para384
for _, op := range p.ops {
if op == "Solution" {
sol = Constructor(q.value[0])
} else if op == "reset" {
fmt.Printf("【input】:%v 【output】:%v\n", op, sol.Reset())
} else {
fmt.Printf("【input】:%v 【output】:%v\n", op, sol.Shuffle())
}
}
}
fmt.Printf("\n\n\n")
}

Some files were not shown because too many files have changed in this diff Show More