This repository contains my solutions to LeetCode problems, covering two distinct phases of my learning process.
old/- solutions from 2024, written mostly in JavaScript, organized by difficulty and study plan. Kept as an archive of earlier progress.new/- current solutions, written in C#, organized by algorithmic pattern rather than difficulty. The goal here isn't just solving individual problems, but building a personal reference of recognizable patterns that transfer to new, unseen problems.
Each folder corresponds to one algorithmic pattern. Every solution file includes a short comment explaining when the pattern applies and its time/space complexity, so the folder works as a personal pattern reference, not just a solution dump.
| Folder | Pattern | Example problems |
|---|---|---|
arrays-hashmap |
Storing state in a Dictionary/HashSet to avoid re-scanning | Two Sum, Contains Duplicate, Group Anagrams |
two-pointers |
Two pointers moving through a structure from different ends or speeds | 3Sum, Container With Most Water |
sliding-window |
A window that expands/shrinks dynamically over a sequence | Longest Substring Without Repeating Characters |
stack |
LIFO structure for tracking "open" elements or reversing order | Valid Parentheses, Daily Temperatures |
binary-search |
Repeatedly halving the search space | Search in Rotated Sorted Array |
linked-list |
Pointer manipulation on linked structures | Reverse Linked List, Reorder List |
trees |
DFS/BFS traversal and recursion on trees | Validate BST, Level Order Traversal |
graphs-bfs-dfs |
Traversing graphs, detecting cycles, connectivity | Number of Islands, Course Schedule |
backtracking |
Exploring choices with the ability to undo them | Subsets, Permutations |
dynamic-programming |
Breaking a problem into overlapping subproblems | Climbing Stairs, Coin Change |
priority-queue |
Efficiently retrieving the highest- or lowest-priority element | Relative Ranks, Kth Largest Element in an Array |
Example of the comment style used at the top of each new solution file:
// Pattern: Hashmap for tracking "what I've seen so far"
// When to use: for each element, I'm looking for something related to another element
// Complexity: O(n) time, O(n) space
// Solution:
public int[] TwoSum(int[] nums, int target) {
// ...
}
// Cases:
class Program
{
public static void Main()
{
Solution solution = new Solution();
// Case 1:
var result1 = solution.TwoSum(nums, target);
Console.WriteLine("Result for case 1: " + result1);
// ...
}
}- Arrays & Hashmap
- Two Pointers
- Sliding Window
- Stack
- Binary Search
- Linked List
- Trees
- Graphs (BFS/DFS)
- Backtracking
- Dynamic Programming
- Priority Queue
Solutions mostly in JavaScript/TypeScript, plus SQL, organized by difficulty and original LeetCode study plans.
- Standalone problems:
- Two Sum (JavaScript version), (C# version)
- Palindrome number (JavaScript version), (TypeScript version)
- Score of a string (JavaScript version)
- Search insert position (JavaScript version)
- Longest common prefix (JavaScript version)
- Roman to integer (JavaScript version)
- 30 Days of JavaScript - ~20 problems focused on core JavaScript concepts (closures, promises, array methods, function composition)
- LeetCode 75 – Easy - ~17 problems already grouped by topic: array/string, two pointers, sliding window, prefix sum, hash map/set, linked list, binary tree DFS, binary search tree, queue
- SQL 50 – Easy - ~32 SQL query problems (joins, aggregations, filtering)
- Standalone problems:
- Add two numbers (JavaScript version)
- 30 Days of JavaScript – Medium - ~10 problems covering more advanced JS concepts (debounce, memoize, event emitter, async patterns)
- LeetCode 75 – Medium - ~31 problems grouped by topic: array/string, two pointers, sliding window, stack, hash map/set, linked list, binary tree BFS/DFS, binary search tree, graphs BFS/DFS, queue
- SQL 50 – Medium - ~17 SQL query problems (window functions, subqueries, more complex joins)
- Standalone problems:
- Median of two sorted arrays (JavaScript version)
- SQL 50 – Hard - 1 problem (advanced ranking/window functions)
git clone https://github.com/wersosn/leetcode-problems.gitThis repository is mainly for personal use, but suggestions are welcome.
LeetCode: wersosn