Last active
January 26, 2020 09:58
-
-
Save kfstorm/0f35d62c68ae4bf9c8272711e8abd99a to your computer and use it in GitHub Desktop.
Import C# solutions from https://github.com/kfstorm/LeetCode to https://github.com/doocs/leetcode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import shutil | |
import os | |
import re | |
# This is the directory of https://github.com/kfstorm/leetcode-1/tree/master/solution | |
dest_dir = "../leetcode-1/solution" | |
dest = {int(re.match(r'^\d+', d).group(0)): os.path.join(dest_dir, d) for d in os.listdir(dest_dir) if os.path.isdir(os.path.join(dest_dir, d))} | |
# This is the directory of https://github.com/kfstorm/LeetCode | |
src_dir = "." | |
src = {int(re.match(r'^\d+', f).group(0)): os.path.join(src_dir, f) for f in os.listdir(src_dir) if f.endswith(".cs") and not f.endswith(".Test.cs")} | |
excludes = { 218 } | |
for number, src_file in src.items(): | |
if number not in excludes: | |
shutil.copyfile(src_file, os.path.join(dest[number], "Solution.cs")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment