-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmake_new.sh
More file actions
executable file
·49 lines (38 loc) · 1011 Bytes
/
Copy pathmake_new.sh
File metadata and controls
executable file
·49 lines (38 loc) · 1011 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/bash
if [ -z "$1" ] || [ "$1" == "--help" ] || [ "$1" == "-h" ]; then
echo "make_new.sh - create new file templates"
echo "usage: ./make_new.sh [options] platform_name question_number question_name"
echo "example: ./make_new.sh Leetcode 1306 jump_game_III"
echo " "
echo "options:"
echo "-h, --help show brief help"
echo "-m, --monthly add monthly leetcode challenge tag"
exit 0
fi
if [ "$1" == "-m" ] || [ "$1" == "--monthly" ]; then
monthly=true
shift
fi
type=$1
number=$2
name=$3
if [ -z "$type" ] || [ -z "$number" ] || [ -z "$name" ]; then
echo "Missing inputs"
exit 1
fi
if [ "$type" == "lc" ]; then
type="Leetcode"
fi
is_monthly () {
if [ "$monthly" == true ]; then
echo -e "$(date +%B) Leetcoding challenge\n"
fi
}
cat > ./algorithms/$name.py << EOL
"""
$type $number
$(is_monthly)
"""
from typing import List, Optional
import collections, bisect, heapq, itertools, functools, math, random
EOL