Skip to content

Commit 2fcbd2c

Browse files
committed
fixes the issue to enter ms and MB, also , create a solution.cpp
1 parent ddf5262 commit 2fcbd2c

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

scripts/create_solution.sh

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ create_solution() {
1717
read -p "Enter the title of the problem: " title
1818

1919
# Generate URL using submission ID
20-
url="/submissions/detail/$submission_id/"
20+
url="https://leetcode.com/submissions/detail/$submission_id/"
2121

2222
# Create the metadata.json without the code field
2323
metadata_json="$solution_folder/metadata.json"
@@ -30,11 +30,11 @@ create_solution() {
3030
"timestamp": $(date +%s),
3131
"status": 10,
3232
"status_display": "Accepted",
33-
"runtime": "$runtime",
33+
"runtime": "$runtime ms",
3434
"url": "$url",
3535
"is_pending": "Not Pending",
3636
"title": "$title",
37-
"memory": "$memory",
37+
"memory": "$memory MB",
3838
"title_slug": "$(echo $title | tr '[:upper:]' '[:lower:]' | tr ' ' '-')",
3939
"has_notes": false,
4040
"flag_type": 1
@@ -49,17 +49,25 @@ EOF
4949
**Question ID**: $question_id
5050
**Language**: C++
5151
**Status**: Accepted
52-
**Runtime**: $runtime
53-
**Memory**: $memory
52+
**Runtime**: $runtime ms
53+
**Memory**: $memory MB
5454
5555
## Solution Code
5656
\`\`\`cpp
57-
// Solution code removed intentionally.
57+
$url
5858
\`\`\`
59+
EOF
60+
solution="$solution_folder/solution.cpp"
61+
cat <<EOF > "$solution"
62+
#include <bits/stdc++.h>
63+
using namespace std;
64+
65+
$url
66+
5967
EOF
6068

6169
echo "Solution folder created: $solution_folder"
62-
echo "README.md and metadata.json files created successfully."
70+
echo "README.md , metadata.json solution.cpp files created successfully."
6371
}
6472

6573
# Run the function to create a solution

0 commit comments

Comments
 (0)