Skip to main content

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)

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 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
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
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
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.
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)

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
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 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 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

1

Choose Your Focus

Decide whether you want to strengthen your understanding of specific data structures or master algorithm design techniques.
2

Start with Fundamentals

If you’re new to a topic, begin with easier problems (arrays, stacks) before moving to complex structures (trees, graphs).
3

Study Multiple Solutions

Many problems include multiple solution approaches. Compare them to understand trade-offs between time and space complexity.
4

Analyze Complexity

Always review the time and space complexity analysis to develop intuition for algorithmic efficiency.
5

Implement from Scratch

Try implementing solutions yourself before looking at the provided code. This builds problem-solving skills.

Problem Difficulty Distribution

  • 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.

Build docs developers (and LLMs) love