File tree Expand file tree Collapse file tree 4 files changed +9904
-9032
lines changed Expand file tree Collapse file tree 4 files changed +9904
-9032
lines changed Original file line number Diff line number Diff line change 17
17
"rome" : " ^10.0.4-beta"
18
18
},
19
19
"scripts" : {
20
- "release" : " zip leetcode-cheat.zip build/ && mv leetcode-cheat.zip ../leetcode-cheat-release/ && git commit -am 'feat: release' && git push" ,
20
+ "release" : " zip -r leetcode-cheat.zip build/ && mv leetcode-cheat.zip ../leetcode-cheat-release/ && cd ../leetcode-cheat-release && git commit -am 'feat: release' && git push" ,
21
21
"lint" : " eslint src" ,
22
22
"start" : " react-scripts start" ,
23
23
"build" : " react-scripts build" ,
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ const { Panel } = Collapse;
21
21
22
22
const formatCodeToMarkDown = ( code , lang ) => `\`\`\`${ lang } \n${ code } \`\`\`\n` ;
23
23
24
- const { problems } = db ;
24
+ const { problems, company } = db ;
25
25
const dataSource = Object . values ( problems ) ;
26
26
27
27
function inLeetCodeWebsite ( url ) {
@@ -144,15 +144,25 @@ function App() {
144
144
</ a >
145
145
</ Fragment >
146
146
) }
147
- { problems [ problemId ] . companies . map ( ( { name } ) => (
148
- < TagOrLink
149
- key = { name }
150
- text = { name }
151
- link = { null }
152
- color = { getColor ( name ) }
153
- style = { { marginBottom : 6 } }
154
- />
155
- ) ) }
147
+ < Collapse >
148
+ { problems [ problemId ] . companies . map ( ( { name } ) => (
149
+ < Panel header = { name } key = { name } >
150
+ < ul >
151
+ { company [ name ] . map ( ( id ) => (
152
+ < li >
153
+ < Button
154
+ type = "link"
155
+ href = { `${ LEETCODE_CN_URL } /problems/${ id } ` }
156
+ target = "_blank"
157
+ >
158
+ { id }
159
+ </ Button >
160
+ </ li >
161
+ ) ) }
162
+ </ ul >
163
+ </ Panel >
164
+ ) ) }
165
+ </ Collapse >
156
166
</ TabPane >
157
167
< TabPane tab = "题解" key = "2" >
158
168
< Button
Original file line number Diff line number Diff line change 1
1
import { db_collection } from "./root.db" ;
2
2
3
- const tags = {
4
- dp : {
5
- id : "dp" ,
6
- text : "动态规划" ,
7
- color : "cyan" ,
8
- link :
9
- "https://github.com/azl397985856/leetcode/blob/master/thinkings/dynamic-programming.md" ,
10
- } ,
11
- recursion : {
12
- id : "recursion" ,
13
- text : "递归" ,
14
- color : "#f50" ,
15
- link : null ,
16
- } ,
17
- queue : {
18
- id : "queue" ,
19
- text : "队列" ,
20
- color : "#108ee9" ,
21
- link : null ,
22
- } ,
3
+ // const tags = {
4
+ // dp: {
5
+ // id: "dp",
6
+ // text: "动态规划",
7
+ // color: "cyan",
8
+ // link:
9
+ // "https://github.com/azl397985856/leetcode/blob/master/thinkings/dynamic-programming.md",
10
+ // },
11
+ // recursion: {
12
+ // id: "recursion",
13
+ // text: "递归",
14
+ // color: "#f50",
15
+ // link: null,
16
+ // },
17
+ // queue: {
18
+ // id: "queue",
19
+ // text: "队列",
20
+ // color: "#108ee9",
21
+ // link: null,
22
+ // },
23
23
24
- stack : {
25
- id : "stack" ,
26
- color : "#87d068" ,
27
- text : "栈" ,
28
- link : null ,
29
- } ,
30
- design : {
31
- id : "design" ,
32
- color : "#2db7f5" ,
33
- text : "设计题" ,
34
- link : null ,
35
- } ,
36
- } ;
24
+ // stack: {
25
+ // id: "stack",
26
+ // color: "#87d068",
27
+ // text: "栈",
28
+ // link: null,
29
+ // },
30
+ // design: {
31
+ // id: "design",
32
+ // color: "#2db7f5",
33
+ // text: "设计题",
34
+ // link: null,
35
+ // },
36
+ // };
37
37
38
- const company = {
39
- alibaba : {
40
- name : "阿里巴巴" ,
41
- } ,
42
- } ;
38
+ const company = { } ;
39
+
40
+ Object . values ( db_collection ) . forEach ( ( problem ) => {
41
+ problem . companies . forEach ( ( c ) => {
42
+ if ( company [ c . name ] === void 0 ) company [ c . name ] = [ ] ;
43
+ company [ c . name ] . push ( problem . name ) ;
44
+ } ) ;
45
+ } ) ;
43
46
44
47
export default {
45
48
problems : db_collection ,
46
- tags,
49
+ // tags,
47
50
company,
48
51
} ;
You can’t perform that action at this time.
0 commit comments