Skip to content

Commit cb52b41

Browse files
JavaScalaDeveloperJavaScalaDeveloper
authored andcommitted
Merge remote-tracking branch 'origin/dev_image' into dev_image
2 parents c0221a3 + 56f5f05 commit cb52b41

File tree

1,711 files changed

+139626
-6678
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,711 files changed

+139626
-6678
lines changed

change/scripts/MergeMdFiles.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ public class MergeMdFiles {
66

77
public static void main(String[] args) throws IOException {
88
String directory = "D:\\WorkSpaces\\leetcode-all\\solution"; // 修改为目录路径
9-
String outputFile = "D:\\WorkSpaces\\leetcode-all\\change\\scripts\\out\\leetcode-v2023.md"; // 修改为输出文件路径
9+
String outputFile = "D:\\WorkSpaces\\leetcode-all\\change\\scripts\\out\\leetcode-1~1500-v2023.md"; // 修改为输出文件路径
1010

1111
File dir = new File(directory);
1212
if (!dir.exists() || !dir.isDirectory()) {
@@ -27,14 +27,14 @@ private static void mergeMdFiles(File dir, OutputStream os) throws IOException {
2727
} else if (file.isFile() && file.getName().endsWith(".md")) {
2828
// 忽略solution根目录的文件
2929
if (file.getPath().length() > 60) {
30-
// String num = file.getPath().substring(46, 50);
31-
// int no = Integer.parseInt(num);
30+
String num = file.getPath().substring(46, 50);
31+
int no = Integer.parseInt(num);
3232
// 导出前2000道
33-
// if (no <= 2000) {
33+
if (no <= 1500) {
3434
FileInputStream fis = new FileInputStream(file);
3535
copy(fis, os);
3636
fis.close();
37-
// }
37+
}
3838

3939
}
4040
}

change/scripts/MergeMdFilesByLevel.java

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import java.util.stream.Collectors;
99

1010
public class MergeMdFilesByLevel {
11+
private final static int MAX_EXPORT_SIZE = 1500;
1112
private static final String OUTPUT_PATH = "D:\\WorkSpaces\\leetcode-all\\change\\scripts\\out\\"; // 修改为输出文件路径
1213
//题号->难度
1314
private static final Map<String, String> num2LevelMap = ParseMenu.getLineData().stream()
@@ -23,9 +24,9 @@ public static void main(String[] args) throws IOException {
2324
}
2425
Map<String, FileOutputStream> fileOutputStreamsMap = new HashMap<>();
2526
// 中等, 困难, 简单
26-
fileOutputStreamsMap.put("简单", new FileOutputStream(OUTPUT_PATH + "easy-v2023.md"));
27-
fileOutputStreamsMap.put("中等", new FileOutputStream(OUTPUT_PATH + "medium-v2023.md"));
28-
fileOutputStreamsMap.put("困难", new FileOutputStream(OUTPUT_PATH + "hard-v2023.md"));
27+
fileOutputStreamsMap.put("简单", new FileOutputStream(OUTPUT_PATH + "easy-1~" + MAX_EXPORT_SIZE + "-v2023.md"));
28+
fileOutputStreamsMap.put("中等", new FileOutputStream(OUTPUT_PATH + "medium-1~" + MAX_EXPORT_SIZE + "-v2023.md"));
29+
fileOutputStreamsMap.put("困难", new FileOutputStream(OUTPUT_PATH + "hard-1~" + MAX_EXPORT_SIZE + "-v2023.md"));
2930

3031
mergeMdFiles(dir, fileOutputStreamsMap);
3132
fileOutputStreamsMap.forEach((s, fileOutputStream) -> {
@@ -47,15 +48,19 @@ private static void mergeMdFiles(File dir, Map<String, FileOutputStream> fileOut
4748
} else if (basicFileAttributes.isRegularFile() && file.getName().endsWith(".md")) {
4849
FileInputStream fis = new FileInputStream(file);
4950
String path = file.getPath();
50-
if (path.length() > 50) {
51+
if (path.length() > 60) {
5152
// 题号
5253
String num = path.substring(46, 50);
54+
int no = Integer.parseInt(num);
55+
// 导出前2000道
56+
if (no <= MAX_EXPORT_SIZE) {
5357
// 难度
54-
String level = num2LevelMap.get(num);
55-
FileOutputStream os = fileOutputStreamsMap.get(level);
56-
if (os != null) {
57-
System.out.println(num + "-->" + level);
58-
copy(fis, os);
58+
String level = num2LevelMap.get(num);
59+
FileOutputStream os = fileOutputStreamsMap.get(level);
60+
if (os != null) {
61+
System.out.println(num + "-->" + level);
62+
copy(fis, os);
63+
}
5964
}
6065
}
6166
fis.close();

0 commit comments

Comments
 (0)