Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
CSDN 技术社区
skill_tree_algorithm
提交
7c76b1d2
S
skill_tree_algorithm
项目概览
CSDN 技术社区
/
skill_tree_algorithm
通知
9
Star
8
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
skill_tree_algorithm
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
7c76b1d2
编写于
12月 07, 2021
作者:
M
Mars Liu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
for merge
上级
8f95621a
变更
12
显示空白变更内容
内联
并排
Showing
12 changed file
with
79 addition
and
111 deletion
+79
-111
.gitignore
.gitignore
+3
-1
data/1.算法初阶/1.蓝桥杯-基础/30.k倍区间/solution.json
data/1.算法初阶/1.蓝桥杯-基础/30.k倍区间/solution.json
+4
-2
data/1.算法初阶/1.蓝桥杯-基础/37.平面切分/solution.json
data/1.算法初阶/1.蓝桥杯-基础/37.平面切分/solution.json
+4
-2
data/1.算法初阶/3.蓝桥杯-递归/7.逆波兰表达式/solution.json
data/1.算法初阶/3.蓝桥杯-递归/7.逆波兰表达式/solution.json
+2
-1
data/1.算法初阶/5.蓝桥杯-模拟/13.灵能传输/solution.json
data/1.算法初阶/5.蓝桥杯-模拟/13.灵能传输/solution.json
+4
-2
data/1.算法初阶/5.蓝桥杯-模拟/16.三体攻击/solution.json
data/1.算法初阶/5.蓝桥杯-模拟/16.三体攻击/solution.json
+4
-2
data/1.算法初阶/7.蓝桥杯-动态规划/3.装饰珠/solution.json
data/1.算法初阶/7.蓝桥杯-动态规划/3.装饰珠/solution.json
+4
-2
data/1.算法初阶/7.蓝桥杯-动态规划/5.组合数问题/solution.json
data/1.算法初阶/7.蓝桥杯-动态规划/5.组合数问题/solution.json
+4
-2
data/1.算法初阶/7.蓝桥杯-动态规划/6.糖果/solution.json
data/1.算法初阶/7.蓝桥杯-动态规划/6.糖果/solution.json
+4
-2
data/1.算法初阶/7.蓝桥杯-动态规划/8.垒骰子/solution.json
data/1.算法初阶/7.蓝桥杯-动态规划/8.垒骰子/solution.json
+4
-2
leetcode_helper.py
leetcode_helper.py
+42
-91
main.py
main.py
+0
-2
未找到文件。
.gitignore
浏览文件 @
7c76b1d2
...
...
@@ -20,3 +20,5 @@ tools.py
back_.md
test.md
lanqiao.cpp
*.iml
**/.idea/**
\ No newline at end of file
data/1.算法初阶/1.蓝桥杯-基础/30.k倍区间/solution.json
浏览文件 @
7c76b1d2
{
"type"
:
"code_options"
,
"author"
:
"csdn.net"
,
"source"
:
"solution.md.md"
,
"exercise_id"
:
"d5ad2458a40a46daaf75bbb9291e6d4b"
"source"
:
"solution.md"
,
"exercise_id"
:
"d5ad2458a40a46daaf75bbb9291e6d4b"
,
"notebook_enable"
:
true
}
\ No newline at end of file
data/1.算法初阶/1.蓝桥杯-基础/37.平面切分/solution.json
浏览文件 @
7c76b1d2
{
"type"
:
"code_options"
,
"author"
:
"csdn.net"
,
"source"
:
"solution.md.md"
,
"exercise_id"
:
"e572003202d0462fa95f635381897624"
"source"
:
"solution.md"
,
"exercise_id"
:
"e572003202d0462fa95f635381897624"
,
"notebook_enable"
:
true
}
\ No newline at end of file
data/1.算法初阶/3.蓝桥杯-递归/7.逆波兰表达式/solution.json
浏览文件 @
7c76b1d2
{
"type"
:
"code_options"
,
"author"
:
"csdn.net"
,
"source"
:
"solution.md
.md
"
,
"source"
:
"solution.md"
,
"exercise_id"
:
"c29652154669434cb71e4f036b690fef"
}
\ No newline at end of file
data/1.算法初阶/5.蓝桥杯-模拟/13.灵能传输/solution.json
浏览文件 @
7c76b1d2
{
"type"
:
"code_options"
,
"author"
:
"csdn.net"
,
"source"
:
"solution.md.md"
,
"exercise_id"
:
"a7672a561bd14ce5ba8bca21c4074683"
"source"
:
"solution.md"
,
"exercise_id"
:
"a7672a561bd14ce5ba8bca21c4074683"
,
"notebook_enable"
:
true
}
\ No newline at end of file
data/1.算法初阶/5.蓝桥杯-模拟/16.三体攻击/solution.json
浏览文件 @
7c76b1d2
{
"type"
:
"code_options"
,
"author"
:
"csdn.net"
,
"source"
:
"solution.md.md"
,
"exercise_id"
:
"4db03bcefa5649d19f4dd5fe293221ab"
"source"
:
"solution.md"
,
"exercise_id"
:
"4db03bcefa5649d19f4dd5fe293221ab"
,
"notebook_enable"
:
true
}
\ No newline at end of file
data/1.算法初阶/7.蓝桥杯-动态规划/3.装饰珠/solution.json
浏览文件 @
7c76b1d2
{
"type"
:
"code_options"
,
"author"
:
"csdn.net"
,
"source"
:
"solution.md.md"
,
"exercise_id"
:
"8b374f1e3965460e97f165638222ab90"
"source"
:
"solution.md"
,
"exercise_id"
:
"8b374f1e3965460e97f165638222ab90"
,
"notebook_enable"
:
true
}
\ No newline at end of file
data/1.算法初阶/7.蓝桥杯-动态规划/5.组合数问题/solution.json
浏览文件 @
7c76b1d2
{
"type"
:
"code_options"
,
"author"
:
"csdn.net"
,
"source"
:
"solution.md.md"
,
"exercise_id"
:
"3c3985435f414d7f9a8bbdcf42a42d46"
"source"
:
"solution.md"
,
"exercise_id"
:
"3c3985435f414d7f9a8bbdcf42a42d46"
,
"notebook_enable"
:
true
}
\ No newline at end of file
data/1.算法初阶/7.蓝桥杯-动态规划/6.糖果/solution.json
浏览文件 @
7c76b1d2
{
"type"
:
"code_options"
,
"author"
:
"csdn.net"
,
"source"
:
"solution.md.md"
,
"exercise_id"
:
"3c7880dd590c4f7cbe182c2c00af0e5a"
"source"
:
"solution.md"
,
"exercise_id"
:
"3c7880dd590c4f7cbe182c2c00af0e5a"
,
"notebook_enable"
:
true
}
\ No newline at end of file
data/1.算法初阶/7.蓝桥杯-动态规划/8.垒骰子/solution.json
浏览文件 @
7c76b1d2
{
"type"
:
"code_options"
,
"author"
:
"csdn.net"
,
"source"
:
"solution.md.md"
,
"exercise_id"
:
"6b4b68a3ead544a2a9640d9ca6f008b1"
"source"
:
"solution.md"
,
"exercise_id"
:
"6b4b68a3ead544a2a9640d9ca6f008b1"
,
"notebook_enable"
:
true
}
\ No newline at end of file
leetcode_helper.py
浏览文件 @
7c76b1d2
...
...
@@ -5,6 +5,7 @@ import json
import
uuid
import
argparse
import
collections
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
"--run"
,
type
=
str
,
help
=
"Decide to run which function"
)
args
=
parser
.
parse_args
()
...
...
@@ -26,6 +27,7 @@ def get_files_path(file_dir, filetype='.txt'):
files_path
.
append
(
os
.
path
.
join
(
root
,
file
))
return
files_path
def
leetcode_helper
():
data_dir
=
'data/3.算法高阶/1.leetcode'
dailycode_exercises_dir
=
'/Users/zhangzc/Desktop/workplace/daily-code-data/data/input/dailycode/leetcode/exercises'
...
...
@@ -40,9 +42,10 @@ def leetcode_helper():
assert
os
.
path
.
isdir
(
dir
)
exercises_id
=
dir
.
split
(
'/'
)[
-
1
].
split
(
'_'
)[
0
]
if
0
<=
int
(
exercises_id
)
and
int
(
exercises_id
)
<
100
:
desc_src_path
=
os
.
path
.
join
(
os
.
path
.
join
(
dailycode_exercises_dir
,
exercises_id
),
'{}_desc.html'
.
format
(
exercises_id
))
cpp_code_src_path
=
os
.
path
.
join
(
os
.
path
.
join
(
dailycode_exercises_dir
,
exercises_id
),
'{}.cpp'
.
format
(
exercises_id
))
desc_src_path
=
os
.
path
.
join
(
os
.
path
.
join
(
dailycode_exercises_dir
,
exercises_id
),
'{}_desc.html'
.
format
(
exercises_id
))
cpp_code_src_path
=
os
.
path
.
join
(
os
.
path
.
join
(
dailycode_exercises_dir
,
exercises_id
),
'{}.cpp'
.
format
(
exercises_id
))
desc_dst_path
=
os
.
path
.
join
(
dir
,
'desc.html'
)
cpp_code_dst_path
=
os
.
path
.
join
(
dir
,
'solution.cpp'
)
...
...
@@ -101,6 +104,7 @@ def leetcode_helper_delete_md():
if
leetcode_solution_md_data
==
template
:
os
.
remove
(
solution_md_path
)
def
leetcode_helper_update_md
():
data_dir
=
'data/3.算法高阶/1.leetcode'
dirs_
=
os
.
listdir
(
data_dir
)
...
...
@@ -130,6 +134,7 @@ def leetcode_helper_update_md():
with
open
(
solution_md_path
,
'w'
,
encoding
=
'utf-8'
)
as
f
:
f
.
write
(
solution_md_data
)
def
leetcode_helper_update_config
():
data_dir
=
'data/3.算法高阶/1.leetcode'
dirs_
=
os
.
listdir
(
data_dir
)
...
...
@@ -161,7 +166,7 @@ def leetcode_helper_update_config():
"type"
:
"code_options"
,
"author"
:
"CSDN.net"
,
"source"
:
"solution.md"
,
"exercise_id"
:
exercise_id
,
"exercise_id"
:
exercise_id
,
}
solution_json
=
json
.
dumps
(
solution_json_data
,
ensure_ascii
=
False
,
indent
=
3
)
with
open
(
solution_json_path
,
'w'
,
encoding
=
'utf-8'
)
as
f
:
...
...
@@ -213,7 +218,6 @@ def count_exercises():
print
(
lacked_id
)
def
modify_config_and_dir_name
():
# dirs = ['data/2.算法中阶', 'data/3.算法高阶']
# exercises_ids = []
...
...
@@ -249,10 +253,7 @@ def modify_config_and_dir_name():
f
.
write
(
config_data_json
)
def
modify_config_and_dir_name_new
():
dirs
=
[
'data/2.算法中阶'
,
'data/3.算法高阶'
,
'data/1.算法初阶'
]
exercises_ids
=
[]
for
dir
in
dirs
:
...
...
@@ -308,8 +309,6 @@ def modify_config_and_dir_name_new():
with
open
(
solution_md_path
,
'w'
,
encoding
=
'utf-8'
)
as
f
:
f
.
write
(
solution_md_data
)
# with open(config_path, 'r', encoding='utf-8') as f:
# config_data = json.load(f)
# del config_data['title']
...
...
@@ -320,9 +319,6 @@ def modify_config_and_dir_name_new():
# f.write(config_data_json)
def
modify_back_up_dir_name
():
# dirs = ['data/2.算法中阶', 'data/3.算法高阶']
# exercises_ids = []
...
...
@@ -369,14 +365,13 @@ def leetcode_helper_add_sloutionjson():
"type"
:
"code_options"
,
"author"
:
"CSDN.net"
,
"source"
:
"solution.md"
,
"exercise_id"
:
exercise_id
,
"exercise_id"
:
exercise_id
,
}
solution_json
=
json
.
dumps
(
solution_json_data
,
ensure_ascii
=
False
,
indent
=
2
)
with
open
(
solution_json_path
,
'w'
,
encoding
=
'utf-8'
)
as
f
:
f
.
write
(
solution_json
)
def
fix_bug
():
data_dir
=
'data_backup/1.leetcode'
dirs_
=
os
.
listdir
(
data_dir
)
...
...
@@ -429,7 +424,6 @@ def fix_bug():
f
.
write
(
solution_md_data
)
def
add_color_for_special_exercises
():
count
=
0
...
...
@@ -453,7 +447,7 @@ def add_color_for_special_exercises():
for
idx
,
tem_dir
in
enumerate
(
exercises_dirs
):
config_path
=
os
.
path
.
join
(
tem_dir
,
'config.json'
)
solution_md_path
=
os
.
path
.
join
(
tem_dir
,
'solution.md'
)
count
+=
1
count
+=
1
print
(
solution_md_path
)
with
open
(
solution_md_path
,
'r'
,
encoding
=
'utf-8'
)
as
f
:
solution_md_data
=
f
.
read
()
...
...
@@ -465,8 +459,6 @@ def add_color_for_special_exercises():
print
(
'当前已有 {} 道习题'
.
format
(
count
))
def
add_solution_md_template_for_lanqiao
():
data_dir
=
'data_backup/3.蓝桥杯'
dirs_
=
os
.
listdir
(
data_dir
)
...
...
@@ -624,8 +616,6 @@ def fixbug_for_md():
f
.
write
(
solution_md_data
)
if
helper_function
==
'count_tag_class'
:
count_tag_class
()
if
helper_function
==
'count_exercises'
:
...
...
@@ -633,50 +623,11 @@ if helper_function == 'count_exercises':
if
helper_function
==
'modify_back_up_dir_name'
:
modify_back_up_dir_name
()
# add_solution_md_template_for_lanqiao()
# add_color_for_special_exercises()
def
remove_unse_md_file
():
count
=
0
dirs
=
[
'data/2.算法中阶'
,
'data/3.算法高阶'
,
'data/1.算法初阶'
]
exercises_ids
=
[]
for
dir
in
dirs
:
dirs_
=
os
.
listdir
(
dir
)
algo_floor_dirs
=
[]
for
algo_floor_dir
in
dirs_
:
leetcode_class_dir
=
os
.
path
.
join
(
dir
,
algo_floor_dir
)
if
os
.
path
.
isdir
(
leetcode_class_dir
):
algo_floor_dirs
.
append
(
leetcode_class_dir
)
for
algo_floor_dir
in
algo_floor_dirs
:
exercises_dirs_
=
os
.
listdir
(
algo_floor_dir
)
exercises_dirs
=
[]
for
exercises_dir_
in
exercises_dirs_
:
exercises_dir
=
os
.
path
.
join
(
algo_floor_dir
,
exercises_dir_
)
if
os
.
path
.
isdir
(
exercises_dir
):
exercises_dirs
.
append
(
exercises_dir
)
for
idx
,
tem_dir
in
enumerate
(
exercises_dirs
):
desc_md_path
=
os
.
path
.
join
(
tem_dir
,
'desc.md'
)
print
(
desc_md_path
)
if
os
.
path
.
exists
(
desc_md_path
):
os
.
remove
(
desc_md_path
)
remove_unse_md_file
()
# check_exercises_is_duplicate()
# leetcode_helper_update_md()
# leetcode_helper_update_config()
main.py
浏览文件 @
7c76b1d2
...
...
@@ -5,5 +5,3 @@ if __name__ == '__main__':
walker
=
TreeWalker
(
"data"
,
"algorithm"
,
"Algorithm"
)
walker
.
walk
()
math
=
MathWalker
(
'data'
)
math
.
walk
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录