Algorithm Studio

Select a pattern to visualize and learn step-by-step

24 Patterns
5 Easy
15 Medium
Two Pointers
easy
Not Started
Two Pointers
Use two pointers moving toward each other to find pairs that satisfy a condition in a sorted array.

5 examples:

LC 167: Two Sum II (Target 9)
+4 more
Sliding Window
medium
Not Started
Sliding Window
Maintain a window of elements and slide it to find optimal subarrays.

5 examples:

LC 643: Max Subarray Sum (k=3)
+4 more
Binary Search
easy
Not Started
Binary Search
Efficiently search in sorted data by eliminating half the search space.

5 examples:

LC 704: Binary Search
+4 more
Breadth-First Search
medium
Not Started
Breadth-First Search
Explore graphs and trees level by level. Great for shortest path.

5 examples:

LC 102: Level Order Traversal
+4 more
Depth-First Search
medium
Not Started
Depth-First Search
Explore as deep as possible before backtracking.

5 examples:

LC 94: Inorder Traversal
+4 more
Dynamic Programming
medium
Not Started
Dynamic Programming
Break problems into overlapping subproblems and cache results.

5 examples:

LC 509: Fibonacci (n=8)
+4 more
Backtracking
medium
Not Started
Backtracking
Explore all possible solutions by building incrementally and abandoning ("backtracking") when constraints are violated.

4 examples:

LC 46: Permutations [1,2,3]
+3 more
Stack Operations
easy
Not Started
Stack Operations
LIFO data structure for parentheses, expression evaluation.

5 examples:

Valid: ()[]{}
+4 more
Heap / Priority Queue
medium
Not Started
Heap / Priority Queue
Efficiently get min/max elements. Top K problems.

5 examples:

LC 215: Kth Largest (k=2)
+4 more
Prefix Sum
easy
Not Started
Prefix Sum
Precompute cumulative sums to answer range queries in O(1).

5 examples:

LC 560: Subarray Sum (k=2)
+4 more
Linked List
medium
Not Started
Linked List
Fast/slow pointers for cycle detection, reversal, merging.

5 examples:

LC 141: Cycle Detection
+4 more
Greedy Algorithm
medium
Not Started
Greedy Algorithm
Make locally optimal choices hoping for global optimum.

5 examples:

LC 122: Stock Trading
+4 more
Bit Manipulation
medium
Not Started
Bit Manipulation
Use bitwise XOR, AND, OR for efficient solutions.

5 examples:

Single Number [2,2,1]
+4 more
Merge Intervals
medium
Not Started
Merge Intervals
Sort intervals and merge overlapping ones. Key for scheduling problems.

5 examples:

Basic Merge
+4 more
Monotonic Stack
medium
Not Started
Monotonic Stack
Maintain a stack with elements in increasing/decreasing order for next greater/smaller problems.

5 examples:

LC 496: Next Greater Element I
+4 more
HashMap & Frequency
easy
Not Started
HashMap & Frequency
Use hash maps for O(1) lookup, frequency counting, and grouping.

5 examples:

LC 1: Two Sum
+4 more
Graph Algorithms
hard
Not Started
Graph Algorithms
Advanced graph algorithms including topological sort, shortest paths, and MST.

5 examples:

LC 207: Course Schedule
+4 more
Design Problems
hard
Not Started
Design Problems
System design problems like LRU Cache, LFU Cache, and data structure design.

5 examples:

LRU Basic Operations
+4 more
Sorting Techniques
medium
Not Started
Sorting Techniques
Sorting-based solutions using custom comparators and sorted properties.

5 examples:

Largest Number
+4 more
Tries (Prefix Trees)
medium
Not Started
Tries (Prefix Trees)
Tree-like data structure for efficient prefix-based string operations and autocomplete.

4 examples:

Insert and Search 'apple'
+3 more
Math & Geometry
medium
Not Started
Math & Geometry
Mathematical operations including modular arithmetic, matrix operations, and computational geometry.

5 examples:

LC 54: Spiral Matrix
+4 more
Union-Find (Disjoint Set)
medium
Not Started
Union-Find (Disjoint Set)
Efficiently track connected components and detect cycles using disjoint sets with path compression and union by rank.

5 examples:

LC 684: Redundant Connection
+4 more
Segment Tree
hard
Not Started
Segment Tree
Efficiently answer range queries and updates in O(log n) time using a binary tree structure.

5 examples:

LC 307: Range Sum Query
+4 more
Pattern Matching
hard
Not Started
Pattern Matching
Efficiently search for patterns in strings using KMP, Rabin-Karp, or wildcard matching algorithms.

5 examples:

LC 28: KMP Search
+4 more