Skip to content

LeetCodeUtils is a lightweight .NET 8 library providing canonical data structures and helper utilities for solving algorithm problems. Includes ListNode and TreeNode with creation and printing methods, plus console demos and xUnit tests. Ideal for LeetCode practice and interview prep.

License

Notifications You must be signed in to change notification settings

wblackmon/LeetCodeUtils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Got it Wayne 👍 — here’s a single, consolidated README.md file that combines everything we scaffolded (solution overview, usage, tests, NuGet packaging, roadmap, license) into one clean Markdown document:


📘 README.md

# LeetCodeUtils

LeetCodeUtils is a reusable **.NET 8 class library** that provides helper utilities for solving LeetCode problems.  
It includes canonical data structures (`ListNode`, `TreeNode`) and utility methods (`ListNodeUtils`, `TreeNodeUtils`) for **creation, printing, and debugging** linked lists and binary trees.

---

## 📂 Solution Structure

LeetCodeUtils.sln │ ├── src/ │ ├── LeetCodeUtils/ # Class Library (NuGet-ready) │ │ ├── ListNode.cs │ │ ├── TreeNode.cs │ │ ├── ListNodeUtils.cs │ │ └── TreeNodeUtils.cs │ │ │ └── LeetCodeUtils.Console/ # Console demo project │ └── Program.cs │ └── tests/ └── LeetCodeUtils.Tests/ # xUnit test project ├── ListNodeUtilsTests.cs └── TreeNodeUtilsTests.cs


---

## 🚀 Getting Started

### 1. Clone & Build
```bash
git clone https://github.com/wayneblackmon/LeetCodeUtils.git
cd LeetCodeUtils
dotnet build

2. Run Console Demo

dotnet run --project src/LeetCodeUtils.Console

3. Run Tests

dotnet test

🔗 Usage Examples

Linked List

using LeetCodeUtils;

var list = ListNodeUtils.Create(new int[] { 1, 2, 3, 4 });
Console.WriteLine(list.Print()); 
// Output: 1 -> 2 -> 3 -> 4

Binary Tree

using LeetCodeUtils;

var tree = TreeNodeUtils.Create(new int[] { 1, 2, 3, 4, 5 });
Console.WriteLine(tree.Print()); 
// Output: [1, 2, 3, 4, 5]

🧪 Testing

Unit tests are included in the LeetCodeUtils.Tests project using xUnit:

[Fact]
public void Print_ShouldReturnCorrectString()
{
    var head = ListNodeUtils.Create(new int[] { 1, 2, 3 });
    Assert.Equal("1 -> 2 -> 3", head.Print());
}

Run tests:

dotnet test

📦 NuGet Packaging

To build and pack the library:

dotnet pack src/LeetCodeUtils/LeetCodeUtils.csproj -c Release -o ./artifacts

To publish to NuGet.org:

dotnet nuget push ./artifacts/LeetCodeUtils.*.nupkg --api-key YOUR_KEY --source https://api.nuget.org/v3/index.json

🏗️ Roadmap

  • Add PrettyPrint ASCII renderer for binary trees
  • Add random generators for linked lists and trees
  • Add conversion utilities (array ↔ list/tree)
  • Expand test coverage

📜 License

MIT License © Wayne Eliot Blackmon


---

⚡ This is now a **single, self‑contained README file** you can drop into the root of your repo. It covers **solution structure, usage, tests, NuGet packaging, and roadmap** all in one place.  

👉 Do you want me to also add **badges** (build status, NuGet version, test coverage) so your README looks polished when hosted on GitHub?

About

LeetCodeUtils is a lightweight .NET 8 library providing canonical data structures and helper utilities for solving algorithm problems. Includes ListNode and TreeNode with creation and printing methods, plus console demos and xUnit tests. Ideal for LeetCode practice and interview prep.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published