This repository is my personal library of coding patterns — reusable algorithmic approaches that can be applied to solve multiple problems on platforms like LeetCode, Codeforces, HackerRank, or in real-world projects.
The main goal is to understand, memorize, and quickly recognize these patterns during problem-solving, instead of relying on random guesswork.
I've solved hundreds of algorithmic problems, but noticed a repeating truth:
Many problems are just variations of the same core patterns.
The real skill isn't just solving one problem — it's recognizing the underlying technique instantly, and applying it in your own style.
This repo is designed to:
- Build my personal algorithmic muscle memory 🧠
- Document patterns with clear explanations
- Provide multiple code implementations for each pattern
- Categorize patterns for quick navigation
- Create a long-term reference for myself and others
Each pattern has:
- README section explaining:
- When to use the pattern
- Time/space complexity
- Common pitfalls
- Example problems (3–5 per pattern)
- Solutions in C# (my main language), sometimes with Python/Java for comparison
- Pattern Variations if applicable
When to use:
- Problems involving subarrays/substrings
- Optimizing repeated range calculations
- Fixed-size or dynamic ranges
Advantages:
- Reduces O(n²) solutions to O(n)
- Simplifies logic for continuous segments
Common mistakes:
- Forgetting to update the window after moving pointers
- Not handling edge cases (empty arrays, single elements)
Example Problems:
- Find the maximum sum of k consecutive elements
- Longest substring without repeating characters
- Minimum size subarray sum
- Two Pointers
- Sliding Window
- Prefix Sum
- Binary Search Patterns
- Greedy
- Dynamic Programming Templates
- Graph Traversal (BFS/DFS)
- Backtracking
- Heap/Priority Queue
- Hashing Tricks
- Pick a pattern from the list
- Read the theory & common use cases
- Go through the example problems
- Implement them without looking at the solution
- Compare with my solution & note any improvements
This project is licensed under the MIT License — you are free to use, modify, and share the code, but please credit the author.
- Expand examples for competitive programming
- Add a "micro patterns" section (tiny reusable tricks)
- Compare performance of different approaches for the same problem
I'm a developer focused on mastering algorithms and data structures, not just for interview prep, but to be able to solve any problem from scratch, in my own way.
This repository is a key part of that journey.