DEV Community

Sivalingam
Sivalingam

Posted on

I Solved 800+ LeetCode Problems in C# - Here's What I Built

What's on the site

Every solution page has:

  • ✅ Clean, readable C# code with syntax highlighting
  • 📝 The approach explained in plain English
  • ⏱️ Time and space complexity
  • 🔗 Direct link to the LeetCode problem

You can browse by topic (Dynamic Programming, Trees, Graphs, Sliding Window, Two Pointers, and 40+ more) or filter by difficulty (Easy / Medium / Hard).


Example — Two Sum

Here's what a typical solution looks like:

// Approach: Use a dictionary to store each number's index.
// For each number, check if its complement (target - num) already exists.
// Time: O(n) Space: O(n)

public class Solution {
    public int[] TwoSum(int[] nums, int target) {
        var map = new Dictionary<int, int>();
        for (int i = 0; i < nums.Length; i++) {
            int complement = target - nums[i];
            if (map.ContainsKey(complement))
                return new int[] { map[complement], i };
            map[nums[i]] = i;
        }
        return Array.Empty<int>();
    }
}
Enter fullscreen mode Exit fullscreen mode

Every solution follows this pattern — the comment at the top explains the core idea before you read any code.


Why C#?

C# is underused in competitive programming, but it's a great choice:

  • Strong typing catches bugs the compiler
  • LINQ makes array/list operations expressive
  • Dictionary<K,V> and HashSet<T> are fast and easy to use
  • It's what most .NET/backend engineers use day-to-day

If you're preparing for interviews at Microsoft, Amazon, or any .NET shop, practicing in C# makes your prep directly transferable.


GeeksforGeeks too

I also solve the GFG Problem of the Day every day in Java. Those are at dsasolved.com/gfg — 530+ solutions and growing daily.


Tech behind the site

Built with Next.js 14 (App Router), fully statically generated — 1,380+ pages pre-rendered at build time. Uses Shiki for syntax highlighting. Deployed on Vercel.

The solutions themselves live in a GitHub repo: each .cs file is one problem. The site reads them at build time and generates the pages.


Top comments (0)