Add powerful shields to README and enhance note generation with automatic shields and LeetCode links
This commit is contained in:
14
README.md
14
README.md
@@ -2,7 +2,21 @@
|
|||||||
|
|
||||||
This repo tracks my journey solving LeetCode problems — not just code, but my thought process, reflections, and patterns I'm mastering.
|
This repo tracks my journey solving LeetCode problems — not just code, but my thought process, reflections, and patterns I'm mastering.
|
||||||
|
|
||||||
|
[](https://leetcode.com/u/cargdev/)
|
||||||
|
[](https://www.python.org/)
|
||||||
|
[](https://www.typescriptlang.org/)
|
||||||
|
[](LICENSE)
|
||||||
|
[](https://github.com/CarGDev/leetcode/commits/master)
|
||||||
|
[](https://github.com/CarGDev/leetcode)
|
||||||
|
|
||||||
## ✅ Progress
|
## ✅ Progress
|
||||||
|
|
||||||
|
[](https://leetcode.com/problemset/?difficulty=EASY)
|
||||||
|
[](https://leetcode.com/problemset/?difficulty=MEDIUM)
|
||||||
|
[](https://leetcode.com/problemset/?difficulty=HARD)
|
||||||
|
[](https://leetcode.com/u/cargdev/)
|
||||||
|
[](https://leetcode.com/u/cargdev/)
|
||||||
|
|
||||||
- **Total Problems Solved**: 75+
|
- **Total Problems Solved**: 75+
|
||||||
- **Notes Written**: 1+ (expanding soon)
|
- **Notes Written**: 1+ (expanding soon)
|
||||||
- **Categories Covered**: Arrays, Hash Maps, Dynamic Programming, Two Pointers, Binary Search, etc.
|
- **Categories Covered**: Arrays, Hash Maps, Dynamic Programming, Two Pointers, Binary Search, etc.
|
||||||
|
|||||||
@@ -57,6 +57,25 @@ get_difficulty() {
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to get difficulty color for shields
|
||||||
|
get_difficulty_color() {
|
||||||
|
local difficulty=$1
|
||||||
|
case $difficulty in
|
||||||
|
"Easy")
|
||||||
|
echo "brightgreen"
|
||||||
|
;;
|
||||||
|
"Medium")
|
||||||
|
echo "orange"
|
||||||
|
;;
|
||||||
|
"Hard")
|
||||||
|
echo "red"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "blue"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
# Function to create note file
|
# Function to create note file
|
||||||
create_note_file() {
|
create_note_file() {
|
||||||
local problem_num=$1
|
local problem_num=$1
|
||||||
@@ -65,14 +84,24 @@ create_note_file() {
|
|||||||
local filename="$NOTES_DIR/$(format_problem_number $problem_num)_$(title_to_filename "$title").md"
|
local filename="$NOTES_DIR/$(format_problem_number $problem_num)_$(title_to_filename "$title").md"
|
||||||
|
|
||||||
if [ ! -f "$filename" ]; then
|
if [ ! -f "$filename" ]; then
|
||||||
|
local difficulty_color=$(get_difficulty_color "$difficulty")
|
||||||
|
local leetcode_url="https://leetcode.com/problems/$(echo "$title" | tr ' ' '-')/"
|
||||||
|
|
||||||
echo "# $title" > "$filename"
|
echo "# $title" > "$filename"
|
||||||
echo "" >> "$filename"
|
echo "" >> "$filename"
|
||||||
echo "**Problem Number:** $problem_num" >> "$filename"
|
echo "[](https://leetcode.com/problems/$(echo "$title" | tr ' ' '-')/)" >> "$filename"
|
||||||
echo "**Difficulty:** $difficulty" >> "$filename"
|
echo "[](https://leetcode.com/problemset/?difficulty=$(echo "$difficulty" | tr '[:lower:]' '[:upper:]'))" >> "$filename"
|
||||||
|
echo "[]($leetcode_url)" >> "$filename"
|
||||||
|
echo "" >> "$filename"
|
||||||
|
echo "**Problem Number:** [$problem_num]($leetcode_url)" >> "$filename"
|
||||||
|
echo "**Difficulty:** [$difficulty](https://leetcode.com/problemset/?difficulty=$(echo "$difficulty" | tr '[:lower:]' '[:upper:]'))" >> "$filename"
|
||||||
echo "**Category:** " >> "$filename"
|
echo "**Category:** " >> "$filename"
|
||||||
|
echo "**LeetCode Link:** [$leetcode_url]($leetcode_url)" >> "$filename"
|
||||||
echo "" >> "$filename"
|
echo "" >> "$filename"
|
||||||
echo "## Problem Description" >> "$filename"
|
echo "## Problem Description" >> "$filename"
|
||||||
echo "" >> "$filename"
|
echo "" >> "$filename"
|
||||||
|
echo "> **View the full problem description on LeetCode:** [$title]($leetcode_url)" >> "$filename"
|
||||||
|
echo "" >> "$filename"
|
||||||
echo "## My Approach" >> "$filename"
|
echo "## My Approach" >> "$filename"
|
||||||
echo "" >> "$filename"
|
echo "" >> "$filename"
|
||||||
echo "## Solution" >> "$filename"
|
echo "## Solution" >> "$filename"
|
||||||
@@ -86,6 +115,9 @@ create_note_file() {
|
|||||||
echo "## Related Problems" >> "$filename"
|
echo "## Related Problems" >> "$filename"
|
||||||
echo "" >> "$filename"
|
echo "" >> "$filename"
|
||||||
echo "---" >> "$filename"
|
echo "---" >> "$filename"
|
||||||
|
echo "" >> "$filename"
|
||||||
|
echo "[](../../README.md#-problem-index) | [.py)](../exercises/$problem_num.$(echo "$title" | tr ' ' '-').py)" >> "$filename"
|
||||||
|
echo "" >> "$filename"
|
||||||
echo "*Note: This is a work in progress. I'll add more details as I reflect on this problem.*" >> "$filename"
|
echo "*Note: This is a work in progress. I'll add more details as I reflect on this problem.*" >> "$filename"
|
||||||
|
|
||||||
echo "✅ Created: $filename"
|
echo "✅ Created: $filename"
|
||||||
|
|||||||
@@ -1,11 +1,18 @@
|
|||||||
# two sum ii input array is sorted
|
# two sum ii input array is sorted
|
||||||
|
|
||||||
**Problem Number:** 167
|
[](https://leetcode.com/problems/two-sum-ii-input-array-is-sorted/)
|
||||||
**Difficulty:** Medium
|
[](https://leetcode.com/problemset/?difficulty=MEDIUM)
|
||||||
|
[](https://leetcode.com/problems/two-sum-ii-input-array-is-sorted/)
|
||||||
|
|
||||||
|
**Problem Number:** [167](https://leetcode.com/problems/two-sum-ii-input-array-is-sorted/)
|
||||||
|
**Difficulty:** [Medium](https://leetcode.com/problemset/?difficulty=MEDIUM)
|
||||||
**Category:**
|
**Category:**
|
||||||
|
**LeetCode Link:** [https://leetcode.com/problems/two-sum-ii-input-array-is-sorted/](https://leetcode.com/problems/two-sum-ii-input-array-is-sorted/)
|
||||||
|
|
||||||
## Problem Description
|
## Problem Description
|
||||||
|
|
||||||
|
> **View the full problem description on LeetCode:** [two sum ii input array is sorted](https://leetcode.com/problems/two-sum-ii-input-array-is-sorted/)
|
||||||
|
|
||||||
## My Approach
|
## My Approach
|
||||||
|
|
||||||
## Solution
|
## Solution
|
||||||
@@ -19,4 +26,7 @@
|
|||||||
## Related Problems
|
## Related Problems
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
[](../../README.md#-problem-index) | [](../exercises/167.two-sum-ii-input-array-is-sorted.py)
|
||||||
|
|
||||||
*Note: This is a work in progress. I'll add more details as I reflect on this problem.*
|
*Note: This is a work in progress. I'll add more details as I reflect on this problem.*
|
||||||
|
|||||||
Reference in New Issue
Block a user