Introduction
This repository contains a curated collection of coding problems organized across data structures and algorithm design techniques. Each problem includes detailed solutions with time and space complexity analysis, making it an excellent resource for interview preparation and algorithm mastery.Data Structure Problems
Problems organized by data structure: arrays, linked lists, stacks, queues, and trees
Algorithm Technique Problems
Problems organized by design technique: dynamic programming, divide & conquer, greedy, and backtracking
Problem Categories
Data Structures (17 Problems)
Arrays (7 problems)
Arrays (7 problems)
Array problems focus on matrix manipulation, element searching, merging, and optimization challenges. Topics include matrix rotation, next greater element, sorted array merging, and maximization problems.Difficulty Range: Easy to MediumKey Concepts: Two pointers, matrix manipulation, optimization, element pairing
Linked Lists (2 problems)
Linked Lists (2 problems)
Linked list problems explore list partitioning and arithmetic operations on lists. These problems test understanding of pointer manipulation and list traversal.Difficulty Range: MediumKey Concepts: Pointer manipulation, list partitioning, arithmetic on linked structures
Stacks (2 problems)
Stacks (2 problems)
Stack problems demonstrate LIFO principles through sorting operations and number base conversion challenges.Difficulty Range: Easy to MediumKey Concepts: LIFO ordering, auxiliary data structures, base conversion
Trees (4 problems)
Trees (4 problems)
Tree problems cover tree traversal, serialization, node connection, and dimensional analysis. These are fundamental for understanding hierarchical data structures.Difficulty Range: Medium to HardKey Concepts: Tree traversal (DFS/BFS), serialization, level-order operations
Queues
Queues
Queue problems explore FIFO operations and are commonly used in BFS algorithms and scheduling problems.Status: No problems currently implemented. The queue data structure is available and used in tree traversal problems.
Graphs
Graphs
Graph problems include traversal algorithms, shortest path finding, and cycle detection.Status: No problems currently implemented. The graph data structure is available for extension.
Algorithm Design Techniques (4 Problems)
Dynamic Programming (1 problem)
Dynamic Programming (1 problem)
DP problems demonstrate how to solve optimization problems by breaking them into overlapping subproblems and storing solutions for reuse.Difficulty Range: HardKey Concepts: Memoization, tabulation, optimal substructure
Divide and Conquer (2 problems)
Divide and Conquer (2 problems)
These problems show how to divide problems into independent subproblems, solve recursively, and combine solutions.Difficulty Range: Medium to HardKey Concepts: Recursive decomposition, merge operations, subarray analysis
Greedy Algorithms (1 problem)
Greedy Algorithms (1 problem)
Greedy problems demonstrate making locally optimal choices at each step to find a global optimum.Difficulty Range: Easy to MediumKey Concepts: Local optimization, coin change, activity selection
Backtracking (1 problem)
Backtracking (1 problem)
Backtracking problems explore solution spaces by trying different paths and backtracking when a path doesn’t lead to a solution.Difficulty Range: Medium to HardKey Concepts: State space exploration, constraint satisfaction, pruning
Complexity Analysis
Every problem in this collection includes:Time Complexity
Analysis of how the algorithm’s runtime grows with input size, typically expressed in Big O notation
Space Complexity
Analysis of additional memory required by the algorithm, excluding the input itself
How to Use This Collection
Choose Your Focus
Decide whether you want to strengthen your understanding of specific data structures or master algorithm design techniques.
Start with Fundamentals
If you’re new to a topic, begin with easier problems (arrays, stacks) before moving to complex structures (trees, graphs).
Study Multiple Solutions
Many problems include multiple solution approaches. Compare them to understand trade-offs between time and space complexity.
Analyze Complexity
Always review the time and space complexity analysis to develop intuition for algorithmic efficiency.
Problem Difficulty Distribution
- By Difficulty
- By Category
- Easy: 5 problems (Greedy, basic arrays, stacks)
- Medium: 12 problems (Most data structure problems)
- Hard: 4 problems (DP, advanced tree problems, divide & conquer)
Common Patterns
Across these problems, you’ll encounter recurring patterns:- Two Pointers: Used in array merging and partitioning
- Auxiliary Data Structures: Stacks and queues as helpers
- Recursion: Core to tree, divide & conquer, and backtracking problems
- Hash Maps: For O(1) lookups in optimization problems
- Matrix Manipulation: Layer-by-layer and in-place algorithms
- Traversal Techniques: DFS, BFS, pre-order, in-order, post-order
Next Steps
Browse by Data Structure
Explore problems organized by the underlying data structure
Browse by Technique
Study problems grouped by algorithm design approach
All solutions include working TypeScript implementations with comprehensive test cases. The source code is located in
/workspace/source/ with problem test files named *.problems.test.ts.