From ce9f0dcf97cb7eafb82b097ddc974708295c37af Mon Sep 17 00:00:00 2001 From: Carlos Date: Fri, 11 Jul 2025 12:22:07 -0400 Subject: [PATCH] Add powerful shields to README and enhance note generation with automatic shields and LeetCode links --- README.md | 14 ++++++++ create_missing_notes.sh | 36 +++++++++++++++++-- .../167_two_sum_ii_input_array_is_sorted.md | 14 ++++++-- 3 files changed, 60 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 2caab8b..a0f27a8 100644 --- a/README.md +++ b/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. +[![LeetCode Problems](https://img.shields.io/badge/LeetCode-75%2B%20Solved-brightgreen?style=for-the-badge&logo=leetcode)](https://leetcode.com/u/cargdev/) +[![Python](https://img.shields.io/badge/Python-3.8%2B-blue?style=for-the-badge&logo=python)](https://www.python.org/) +[![TypeScript](https://img.shields.io/badge/TypeScript-5.0%2B-3178C6?style=for-the-badge&logo=typescript)](https://www.typescriptlang.org/) +[![License](https://img.shields.io/badge/License-MIT-green?style=for-the-badge)](LICENSE) +[![Last Commit](https://img.shields.io/github/last-commit/CarGDev/leetcode?style=for-the-badge&color=orange)](https://github.com/CarGDev/leetcode/commits/master) +[![Repository Size](https://img.shields.io/github/repo-size/CarGDev/leetcode?style=for-the-badge&color=blueviolet)](https://github.com/CarGDev/leetcode) + ## ✅ Progress + +[![Easy Problems](https://img.shields.io/badge/Easy-40%2B-brightgreen?style=flat-square)](https://leetcode.com/problemset/?difficulty=EASY) +[![Medium Problems](https://img.shields.io/badge/Medium-30%2B-orange?style=flat-square)](https://leetcode.com/problemset/?difficulty=MEDIUM) +[![Hard Problems](https://img.shields.io/badge/Hard-5%2B-red?style=flat-square)](https://leetcode.com/problemset/?difficulty=HARD) +[![Success Rate](https://img.shields.io/badge/Success%20Rate-95%25-brightgreen?style=flat-square)](https://leetcode.com/u/cargdev/) +[![Streak](https://img.shields.io/badge/Current%20Streak-Active-blue?style=flat-square)](https://leetcode.com/u/cargdev/) + - **Total Problems Solved**: 75+ - **Notes Written**: 1+ (expanding soon) - **Categories Covered**: Arrays, Hash Maps, Dynamic Programming, Two Pointers, Binary Search, etc. diff --git a/create_missing_notes.sh b/create_missing_notes.sh index bb455c6..ca0a680 100755 --- a/create_missing_notes.sh +++ b/create_missing_notes.sh @@ -57,6 +57,25 @@ get_difficulty() { 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 create_note_file() { 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" 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 "" >> "$filename" - echo "**Problem Number:** $problem_num" >> "$filename" - echo "**Difficulty:** $difficulty" >> "$filename" + echo "[![Problem $problem_num](https://img.shields.io/badge/Problem-$problem_num-blue?style=for-the-badge&logo=leetcode)](https://leetcode.com/problems/$(echo "$title" | tr ' ' '-')/)" >> "$filename" + echo "[![Difficulty](https://img.shields.io/badge/Difficulty-$difficulty-$difficulty_color?style=for-the-badge)](https://leetcode.com/problemset/?difficulty=$(echo "$difficulty" | tr '[:lower:]' '[:upper:]'))" >> "$filename" + echo "[![LeetCode](https://img.shields.io/badge/LeetCode-View%20Problem-orange?style=for-the-badge&logo=leetcode)]($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 "**LeetCode Link:** [$leetcode_url]($leetcode_url)" >> "$filename" echo "" >> "$filename" echo "## Problem Description" >> "$filename" echo "" >> "$filename" + echo "> **View the full problem description on LeetCode:** [$title]($leetcode_url)" >> "$filename" + echo "" >> "$filename" echo "## My Approach" >> "$filename" echo "" >> "$filename" echo "## Solution" >> "$filename" @@ -86,6 +115,9 @@ create_note_file() { echo "## Related Problems" >> "$filename" echo "" >> "$filename" echo "---" >> "$filename" + echo "" >> "$filename" + echo "[![Back to Index](../../README.md#-problem-index)](../../README.md#-problem-index) | [![View Solution](../exercises/$problem_num.$(echo "$title" | tr ' ' '-').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 "✅ Created: $filename" diff --git a/src/notes/167_two_sum_ii_input_array_is_sorted.md b/src/notes/167_two_sum_ii_input_array_is_sorted.md index 67dc9d0..28dd657 100644 --- a/src/notes/167_two_sum_ii_input_array_is_sorted.md +++ b/src/notes/167_two_sum_ii_input_array_is_sorted.md @@ -1,11 +1,18 @@ # two sum ii input array is sorted -**Problem Number:** 167 -**Difficulty:** Medium +[![Problem 167](https://img.shields.io/badge/Problem-167-blue?style=for-the-badge&logo=leetcode)](https://leetcode.com/problems/two-sum-ii-input-array-is-sorted/) +[![Difficulty](https://img.shields.io/badge/Difficulty-Medium-orange?style=for-the-badge)](https://leetcode.com/problemset/?difficulty=MEDIUM) +[![LeetCode](https://img.shields.io/badge/LeetCode-View%20Problem-orange?style=for-the-badge&logo=leetcode)](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:** +**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 +> **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 ## Solution @@ -19,4 +26,7 @@ ## Related Problems --- + +[![Back to Index](../../README.md#-problem-index)](../../README.md#-problem-index) | [![View Solution](../exercises/167.two-sum-ii-input-array-is-sorted.py)](../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.*