Skip to content

Latest commit

 

History

History
100 lines (84 loc) · 5.45 KB

File metadata and controls

100 lines (84 loc) · 5.45 KB

LeetCode Solutions

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.

new/ - Pattern-based practice (2026, C#)

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);
        // ...
    }
}

Progress in learning the basics of the most popular topics

  • Arrays & Hashmap
  • Two Pointers
  • Sliding Window
  • Stack
  • Binary Search
  • Linked List
  • Trees
  • Graphs (BFS/DFS)
  • Backtracking
  • Dynamic Programming
  • Priority Queue

old/ - Archive (2024)

Solutions mostly in JavaScript/TypeScript, plus SQL, organized by difficulty and original LeetCode study plans.

Easy

Medium

  • Standalone problems:
  • 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)

Hard

How to use

git clone https://github.com/wersosn/leetcode-problems.git

Contributions

This repository is mainly for personal use, but suggestions are welcome.

Links

LeetCode: wersosn