Skip to content

Latest commit

Β 

History

135 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ› BeetCode

A local C# console application for practicing LeetCode problems in your own IDE. Say goodbye to LeetCode's online editor and hello to VS Code!

✨ Features

  • Local Development: Write solutions in VS Code with all your favorite extensions
  • Multi-Language Support: Practice in C# or TypeScript β€” more languages can be added following the same pattern
  • Automatic Scaffolding: Generate new C# problem files directly from LeetCode data with one command
  • Automatic Testing: Built-in test runner with formatted output and performance stats
  • Problem Management: Easy CLI commands to run, test, and manage problems
  • Solution Resetting: Quickly reset one or all solutions back to their initial state
  • Clean Output: Pretty-printed test results with pass/fail status

πŸš€ Quick Start

Prerequisites

  • .NET 10.0 SDK
  • VS Code (recommended)

Installation

git clone <your-repo-url>
cd BeetCode
dotnet build

Usage

# Generate a new problem file from LeetCode
dotnet run -- scaffold 1

# Run tests for a specific problem
dotnet run -- test 1

# Show problem info and run tests
dotnet run -- run 1

# Show just the problem description
dotnet run -- info 1

# List all available problems and your progress
dotnet run -- list

# Reset a solution
dotnet run -- reset 1

# Show help
dotnet run -- help

πŸ“ Project Structure

BeetCode/
β”œβ”€β”€ Framework/
β”‚   β”œβ”€β”€ LeetCodeClient.cs    # Fetches problem data from LeetCode
β”‚   β”œβ”€β”€ Problem.cs           # Abstract base class for all problems
β”‚   β”œβ”€β”€ ResetHelper.cs       # Utility for resetting solutions
β”‚   β”œβ”€β”€ ScaffoldGenerator.cs # Generates C# boilerplate from problem data
β”‚   β”œβ”€β”€ TestCase.cs          # Test case data structure
β”‚   └── TestRunner.cs        # Test execution engine
β”œβ”€β”€ Problems/
β”‚   β”œβ”€β”€ Problem001.cs        # Two Sum
β”‚   β”œβ”€β”€ Problem002.cs        # Add Two Numbers
β”‚   └── ...                  # More problems as you add them
β”œβ”€β”€ Program.cs               # CLI entry point
└── README.md               # You are here!

🎯 Adding New Problems

Want to practice a new LeetCode problem? Use the scaffold command:

dotnet run -- scaffold 1

This will automatically create a complete problem file with:

  • Problem description, difficulty, and examples
  • Method signature ready for your solution
  • Integration into the test runner

Note: Some problems may require manual adjustment of test cases if the data format is complex.

πŸ’‘ Example Workflow

  1. Scaffold a problem: dotnet run -- scaffold 1
  2. Read the description: dotnet run -- info 1
  3. Open the file: Edit Problems/Problem001.cs
  4. Write your solution: Replace the NotImplementedException
  5. Test it: dotnet run -- test 1
  6. Celebrate: πŸŽ‰ (when all tests pass)

πŸ§ͺ Sample Output

$ dotnet run -- test 1

Running tests for Problem 1: Two Sum
--------------------------------------------------
Example 1: PASS

Example 2: PASS

Example 3: PASS

--------------------------------------------------
Results: 3/3 tests passed
All tests passed! πŸŽ‰

πŸ› οΈ Commands Reference

Command Description Example
scaffold <n> Generate problem file from LeetCode dotnet run -- scaffold 1
test <n> Run tests for a problem dotnet run -- test 1
run <n> Show info + run tests dotnet run -- run 1
info <n> Show problem description dotnet run -- info 1
list List all problems and progress dotnet run -- list
reset <n> Reset a specific solution dotnet run -- reset 1
reset Reset ALL solutions (prompts) dotnet run -- reset
update-data Refresh local LeetCode problem cache dotnet run -- update-data
help Show help message dotnet run -- help

🎨 Why BeetCode?

  • Your IDE, Your Rules: Use VS Code with IntelliSense, debugging, and extensions
  • Version Control: Track your solution progress with Git
  • Offline Practice: No internet required once problems are set up
  • Custom Testing: Add your own test cases beyond LeetCode examples
  • Learning Focus: Clean, distraction-free environment for problem-solving

🀝 Contributing

This is a personal practice tool, but feel free to:

  • Suggest new framework features
  • Report bugs or improvements
  • Share your favorite problem templates

πŸ“„ License

MIT License - Practice away! πŸš€


Progress Summary

Total Solved: 22

Set Easy Medium Hard Total
πŸ…±οΈ Blind 150 21 / 28 0 / 100 0 / 20 21 / 148

🟒 Easy (42 problems β€” 22 / 42)

Arrays & Hashing

βœ… 217 Β· Contains Duplicate πŸ…±οΈ

βœ… 242 Β· Valid Anagram πŸ…±οΈ

βœ… 1 Β· Two Sum πŸ…±οΈ

πŸ”² 26 Β· Remove Duplicates from Sorted Array

πŸ”² 27 Β· Remove Element

πŸ”² 383 Β· Ransom Note

πŸ”² 414 Β· Third Maximum Number

Two Pointers

βœ… 125 Β· Valid Palindrome πŸ…±οΈ

πŸ”² 344 Β· Reverse String

Sliding Window

βœ… 121 Β· Best Time to Buy and Sell Stock πŸ…±οΈ

Stack

βœ… 20 Β· Valid Parentheses πŸ…±οΈ

Strings

πŸ”² 13 Β· Roman to Integer

πŸ”² 14 Β· Longest Common Prefix

πŸ”² 28 Β· Find the Index of the First Occurrence in a String

πŸ”² 58 Β· Length of Last Word

πŸ”² 168 Β· Excel Sheet Column Title

Binary Search

βœ… 704 Β· Binary Search πŸ…±οΈ

Linked List

βœ… 206 Β· Reverse Linked List πŸ…±οΈ

βœ… 141 Β· Linked List Cycle πŸ…±οΈ

βœ… 21 Β· Merge Two Sorted Lists πŸ…±οΈ

Trees

βœ… 226 Β· Invert Binary Tree πŸ…±οΈ

βœ… 104 Β· Maximum Depth of Binary Tree πŸ…±οΈ

βœ… 543 Β· Diameter of Binary Tree πŸ…±οΈ

βœ… 110 Β· Balanced Binary Tree πŸ…±οΈ

βœ… 100 Β· Same Tree πŸ…±οΈ

βœ… 572 Β· Subtree of Another Tree πŸ…±οΈ

Heap / Priority Queue

βœ… 703 Β· Kth Largest Element in a Stream πŸ…±οΈ

βœ… 1046 Β· Last Stone Weight πŸ…±οΈ

1-D Dynamic Programming

βœ… 70 Β· Climbing Stairs πŸ…±οΈ

βœ… 746 Β· Min Cost Climbing Stairs πŸ…±οΈ

Intervals

πŸ”² 252 Β· Meeting Rooms (Premium) πŸ…±οΈ

Math & Geometry

βœ… 202 Β· Happy Number πŸ…±οΈ

πŸ”² 66 Β· Plus One πŸ…±οΈ

πŸ”² 9 Β· Palindrome Number

πŸ”² 258 Β· Add Digits

βœ… 412 Β· Fizz Buzz

Bit Manipulation

πŸ”² 136 Β· Single Number πŸ…±οΈ

πŸ”² 191 Β· Number of 1 Bits πŸ…±οΈ

πŸ”² 338 Β· Counting Bits πŸ…±οΈ

πŸ”² 190 Β· Reverse Bits πŸ…±οΈ

πŸ”² 268 Β· Missing Number πŸ…±οΈ

πŸ”² 389 Β· Find the Difference


🟑 Medium (100 problems β€” 0 / 100)

Arrays & Hashing

πŸ”² 49 Β· Group Anagrams πŸ…±οΈ

πŸ”² 347 Β· Top K Frequent Elements πŸ…±οΈ

πŸ”² 238 Β· Product of Array Except Self πŸ…±οΈ

πŸ”² 36 Β· Valid Sudoku πŸ…±οΈ

πŸ”² 271 Β· Encode and Decode Strings (Premium) πŸ…±οΈ

πŸ”² 128 Β· Longest Consecutive Sequence πŸ…±οΈ

Two Pointers

πŸ”² 167 Β· Two Sum II - Input Array Is Sorted πŸ…±οΈ

πŸ”² 15 Β· 3Sum πŸ…±οΈ

πŸ”² 11 Β· Container With Most Water πŸ…±οΈ

Sliding Window

πŸ”² 3 Β· Longest Substring Without Repeating Characters πŸ…±οΈ

πŸ”² 424 Β· Longest Repeating Character Replacement πŸ…±οΈ

πŸ”² 567 Β· Permutation in String πŸ…±οΈ

Stack

πŸ”² 155 Β· Min Stack πŸ…±οΈ

πŸ”² 150 Β· Evaluate Reverse Polish Notation πŸ…±οΈ

πŸ”² 22 Β· Generate Parentheses πŸ…±οΈ

πŸ”² 739 Β· Daily Temperatures πŸ…±οΈ

πŸ”² 853 Β· Car Fleet πŸ…±οΈ

Binary Search

πŸ”² 74 Β· Search a 2D Matrix πŸ…±οΈ

πŸ”² 875 Β· Koko Eating Bananas πŸ…±οΈ

πŸ”² 153 Β· Find Minimum in Rotated Sorted Array πŸ…±οΈ

πŸ”² 33 Β· Search in Rotated Sorted Array πŸ…±οΈ

πŸ”² 981 Β· Time Based Key-Value Store πŸ…±οΈ

Linked List

πŸ”² 143 Β· Reorder List πŸ…±οΈ

πŸ”² 19 Β· Remove Nth Node From End of List πŸ…±οΈ

πŸ”² 138 Β· Copy List With Random Pointer πŸ…±οΈ

πŸ”² 2 Β· Add Two Numbers πŸ…±οΈ

πŸ”² 287 Β· Find the Duplicate Number πŸ…±οΈ

πŸ”² 146 Β· LRU Cache πŸ…±οΈ

Trees

πŸ”² 235 Β· Lowest Common Ancestor of BST πŸ…±οΈ

πŸ”² 102 Β· Binary Tree Level Order Traversal πŸ…±οΈ

πŸ”² 199 Β· Binary Tree Right Side View πŸ…±οΈ

πŸ”² 1448 Β· Count Good Nodes in Binary Tree πŸ…±οΈ

πŸ”² 98 Β· Validate Binary Search Tree πŸ…±οΈ

πŸ”² 230 Β· Kth Smallest Element in BST πŸ…±οΈ

πŸ”² 105 Β· Construct Binary Tree from Preorder and Inorder πŸ…±οΈ

Tries

πŸ”² 208 Β· Implement Trie (Prefix Tree) πŸ…±οΈ

πŸ”² 211 Β· Design Add and Search Words Data Structure πŸ…±οΈ

Heap / Priority Queue

πŸ”² 973 Β· K Closest Points to Origin πŸ…±οΈ

πŸ”² 215 Β· Kth Largest Element in an Array πŸ…±οΈ

πŸ”² 621 Β· Task Scheduler πŸ…±οΈ

πŸ”² 355 Β· Design Twitter πŸ…±οΈ

Backtracking

πŸ”² 46 Β· Permutations πŸ…±οΈ

πŸ”² 78 Β· Subsets πŸ…±οΈ

πŸ”² 39 Β· Combination Sum πŸ…±οΈ

πŸ”² 90 Β· Subsets II πŸ…±οΈ

πŸ”² 40 Β· Combination Sum II πŸ…±οΈ

πŸ”² 79 Β· Word Search πŸ…±οΈ

πŸ”² 131 Β· Palindrome Partitioning πŸ…±οΈ

πŸ”² 17 Β· Letter Combinations of a Phone Number πŸ…±οΈ

Graphs

πŸ”² 200 Β· Number of Islands πŸ…±οΈ

πŸ”² 133 Β· Clone Graph πŸ…±οΈ

πŸ”² 695 Β· Max Area of Island πŸ…±οΈ

πŸ”² 417 Β· Pacific Atlantic Water Flow πŸ…±οΈ

πŸ”² 130 Β· Surrounded Regions πŸ…±οΈ

πŸ”² 994 Β· Rotting Oranges πŸ…±οΈ

πŸ”² 286 Β· Walls and Gates (Premium) πŸ…±οΈ

πŸ”² 207 Β· Course Schedule πŸ…±οΈ

πŸ”² 210 Β· Course Schedule II πŸ…±οΈ

πŸ”² 684 Β· Redundant Connection πŸ…±οΈ

πŸ”² 323 Β· Number of Connected Components (Premium) πŸ…±οΈ

πŸ”² 261 Β· Graph Valid Tree (Premium) πŸ…±οΈ

Advanced Graphs

πŸ”² 1584 Β· Min Cost to Connect All Points πŸ…±οΈ

πŸ”² 743 Β· Network Delay Time πŸ…±οΈ

πŸ”² 787 Β· Cheapest Flights Within K Stops πŸ…±οΈ

1-D Dynamic Programming

πŸ”² 198 Β· House Robber πŸ…±οΈ

πŸ”² 213 Β· House Robber II πŸ…±οΈ

πŸ”² 5 Β· Longest Palindromic Substring πŸ…±οΈ

πŸ”² 647 Β· Palindromic Substrings πŸ…±οΈ

πŸ”² 91 Β· Decode Ways πŸ…±οΈ

πŸ”² 322 Β· Coin Change πŸ…±οΈ

πŸ”² 139 Β· Word Break πŸ…±οΈ

πŸ”² 300 Β· Longest Increasing Subsequence πŸ…±οΈ

πŸ”² 416 Β· Partition Equal Subset Sum πŸ…±οΈ

2-D Dynamic Programming

πŸ”² 62 Β· Unique Paths πŸ…±οΈ

πŸ”² 1143 Β· Longest Common Subsequence πŸ…±οΈ

πŸ”² 309 Β· Best Time to Buy & Sell Stock with Cooldown πŸ…±οΈ

πŸ”² 518 Β· Coin Change II πŸ…±οΈ

πŸ”² 494 Β· Target Sum πŸ…±οΈ

πŸ”² 97 Β· Interleaving String πŸ…±οΈ

πŸ”² 72 Β· Edit Distance πŸ…±οΈ

Greedy

πŸ”² 53 Β· Maximum Subarray πŸ…±οΈ

πŸ”² 55 Β· Jump Game πŸ…±οΈ

πŸ”² 45 Β· Jump Game II πŸ…±οΈ

πŸ”² 134 Β· Gas Station πŸ…±οΈ

πŸ”² 846 Β· Hand of Straights πŸ…±οΈ

πŸ”² 1899 Β· Merge Triplets to Form Target Triplet πŸ…±οΈ

πŸ”² 763 Β· Partition Labels πŸ…±οΈ

πŸ”² 678 Β· Valid Parenthesis String πŸ…±οΈ

Intervals

πŸ”² 57 Β· Insert Interval πŸ…±οΈ

πŸ”² 56 Β· Merge Intervals πŸ…±οΈ

πŸ”² 435 Β· Non-Overlapping Intervals πŸ…±οΈ

πŸ”² 253 Β· Meeting Rooms II (Premium) πŸ…±οΈ

Math & Geometry

πŸ”² 48 Β· Rotate Image πŸ…±οΈ

πŸ”² 54 Β· Spiral Matrix πŸ…±οΈ

πŸ”² 73 Β· Set Matrix Zeroes πŸ…±οΈ

πŸ”² 50 Β· Pow(x, n) πŸ…±οΈ

πŸ”² 43 Β· Multiply Strings πŸ…±οΈ

πŸ”² 2013 Β· Detect Squares πŸ…±οΈ

Bit Manipulation

πŸ”² 371 Β· Sum of Two Integers πŸ…±οΈ

πŸ”² 7 Β· Reverse Integer πŸ…±οΈ


πŸ”΄ Hard (20 problems β€” 0 / 20)

Two Pointers

πŸ”² 42 Β· Trapping Rain Water πŸ…±οΈ

Sliding Window

πŸ”² 76 Β· Minimum Window Substring πŸ…±οΈ

πŸ”² 239 Β· Sliding Window Maximum πŸ…±οΈ

Stack

πŸ”² 84 Β· Largest Rectangle in Histogram πŸ…±οΈ

Binary Search

πŸ”² 4 Β· Median of Two Sorted Arrays πŸ…±οΈ

Linked List

πŸ”² 23 Β· Merge K Sorted Lists πŸ…±οΈ

πŸ”² 25 Β· Reverse Nodes in K-Group πŸ…±οΈ

Trees

πŸ”² 124 Β· Binary Tree Maximum Path Sum πŸ…±οΈ

πŸ”² 297 Β· Serialize and Deserialize Binary Tree πŸ…±οΈ

Tries

πŸ”² 212 Β· Word Search II πŸ…±οΈ

Heap / Priority Queue

πŸ”² 295 Β· Find Median from Data Stream πŸ…±οΈ

Backtracking

πŸ”² 51 Β· N-Queens πŸ…±οΈ

Advanced Graphs

πŸ”² 332 Β· Reconstruct Itinerary πŸ…±οΈ

πŸ”² 778 Β· Swim in Rising Water πŸ…±οΈ

πŸ”² 269 Β· Alien Dictionary (Premium) πŸ…±οΈ

2-D Dynamic Programming

πŸ”² 329 Β· Longest Increasing Path in a Matrix πŸ…±οΈ

πŸ”² 115 Β· Distinct Subsequences πŸ…±οΈ

πŸ”² 312 Β· Burst Balloons πŸ…±οΈ

πŸ”² 10 Β· Regular Expression Matching πŸ…±οΈ

Intervals

πŸ”² 1851 Β· Minimum Interval to Include Each Query πŸ…±οΈ

About

framework for doing LeetCode problems locally in C#

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages