Skip to content

Commit d61ddef

Browse files
committed
chore: revert generate.js
1 parent 6cd5a18 commit d61ddef

File tree

2 files changed

+5
-22
lines changed

2 files changed

+5
-22
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -880,11 +880,11 @@ LeetCode solutions with JavaScript
880880
| 107 | [Binary Tree Level Order Traversal II](https://leetcode.com/problems/binary-tree-level-order-traversal-ii/) | | | Easy |
881881
| 106 | [Construct Binary Tree from Inorder and Postorder Traversal](https://leetcode.com/problems/construct-binary-tree-from-inorder-and-postorder-traversal/) | | | Medium |
882882
| 105 | [Construct Binary Tree from Preorder and Inorder Traversal](https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/) | | | Medium |
883-
| 104 | [Maximum Depth of Binary Tree](https://leetcode.com/problems/maximum-depth-of-binary-tree/) | | | Easy |
883+
| 104 | [Maximum Depth of Binary Tree](https://leetcode.com/problems/maximum-depth-of-binary-tree/) | | [JavaScript](./algorithms/Maximum%20Depth%20of%20Binary%20Tree/index.js) | Easy |
884884
| 103 | [Binary Tree Zigzag Level Order Traversal](https://leetcode.com/problems/binary-tree-zigzag-level-order-traversal/) | | | Medium |
885885
| 102 | [Binary Tree Level Order Traversal](https://leetcode.com/problems/binary-tree-level-order-traversal/) | | | Medium |
886886
| 101 | [Symmetric Tree](https://leetcode.com/problems/symmetric-tree/) | | | Easy |
887-
| 100 | [Same Tree](https://leetcode.com/problems/same-tree/) | | | Easy |
887+
| 100 | [Same Tree](https://leetcode.com/problems/same-tree/) | | [JavaScript](./algorithms/Same%20Tree/index.js) | Easy |
888888
| 99 | [Recover Binary Search Tree](https://leetcode.com/problems/recover-binary-search-tree/) | | | Hard |
889889
| 98 | [Validate Binary Search Tree](https://leetcode.com/problems/validate-binary-search-tree/) | | | Medium |
890890
| 97 | [Interleaving String](https://leetcode.com/problems/interleaving-string/) | | | Hard |

scripts/generate.js

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
const axios = require('axios');
22
const fs = require('fs');
33

4-
const EXPIRED = 30 * 24 * 60 * 60
54
const API = 'https://leetcode.com/api/problems/algorithms/';
65
const SOLUTION_Path = './algorithms/';
76
let README_TMPL = `# LeetCode
@@ -14,29 +13,17 @@ LeetCode solutions with JavaScript
1413
|:---:|:---:|:---:|:---:|:---:|
1514
`;
1615

17-
getProblems()
16+
fetchProblems()
1817
.then(problems => {
1918
return addSolutions(problems);
2019
})
2120
.then(problems => {
22-
// generateReadme(problems);
21+
generateReadme(problems);
2322
});
2423

25-
function getProblems() {
26-
try {
27-
const stats = fs.statSync('../.cache/problem.js')
28-
29-
if (new Date() - new Date(stats.mtime) > EXPIRED) {
30-
return fetchProblems()
31-
}
32-
33-
return require('../.cache/problem')
34-
} catch (error) {
35-
return fetchProblems()
36-
}
37-
}
3824

3925
function fetchProblems() {
26+
const time = Date.now()
4027
return axios.get(API).then(res => {
4128
const { stat_status_pairs } = res.data;
4229
const difficulty = ['', 'Easy', 'Medium', 'Hard'];
@@ -48,10 +35,6 @@ function fetchProblems() {
4835
difficulty: difficulty[item.difficulty.level]
4936
}))
5037
.sort((a, b) => b.id - a.id);
51-
52-
fs.mkdirSync('../.cache')
53-
fs.writeFileSync('../.cache/problem.js', problems)
54-
5538
return problems;
5639
});
5740
}

0 commit comments

Comments
 (0)