Interactive visualizations for data structures and algorithms
Sort an array using the bubble sort algorithm
Sort an array using the selection sort algorithm
Sort an array using the insertion sort algorithm
Move all zeroes to end while maintaining relative order
Find the majority element in an array
Remove duplicates from a sorted array
Find maximum profit from single buy and sell transaction
Rotate an array by k steps
Calculate product of array except self
Find maximum profit from multiple buy and sell transactions
Find increasing triplet subsequence
Check if s is a subsequence of t
Check if a string is a valid palindrome
Merge two sorted arrays into a single sorted array
Find two numbers that add up to target using two pointers on sorted array
Find two lines that form a container with maximum water capacity
Find all unique triplets that sum to zero
Calculate total water trapped between elevation bars after raining
Find longest subarray with equal number of 0s and 1s using hash map
Check if array has subarray (size ≥ 2) with sum that is multiple of k
Find subarrays with sum equal to target using prefix sums
Find subarrays with sum divisible by k using prefix sums
Find maximum average of contiguous subarray of length k using sliding window
Check if s1 is a permutation of s2 using sliding window
Find all anagrams of s1 in s2 using sliding window
Find minimal length subarray with sum ≥ target using variable-size sliding window
Find max consecutive 1s after flipping at most k zeros using sliding window
Find the length of the longest substring without repeating characters
Find the minimum window in string that contains all characters of target
Find the contiguous subarray with the largest sum (Kadane's Algorithm)
Find the contiguous subarray with the largest product (Kadane's Algorithm)
Find the best sightseeing pair in an array
Traverse matrix in spiral order from outer to inner layers
Find the middle node of a linked list
Remove the nth node from the end of a linked list
Reverse a singly linked list using three pointers
Remove all nodes with duplicate values from a sorted linked list
Merge two sorted linked lists into a single sorted linked list
Detect cycle and find entry point using Floyd's algorithm
Swap every two adjacent nodes in a linked list
Partition a linked list around a value x
Rotate a linked list to the right by k places
Add two numbers represented by linked lists
Determine if a string of brackets is properly balanced using a stack
Remove all adjacent duplicates in a string using a stack
Remove duplicate letters from a string to form the lexicographically smallest string
Remove stars from a string
Evaluate a reverse polish notation expression using a stack
Evaluate a basic calculator expression using a stack
Find the longest valid parentheses substring using a stack
Find the next greater element for each element in nums1 using a stack
Find how many days until a warmer temperature using monotonic stack
Find the 132 pattern in an array using a stack
Find the number of visible people in a queue using a stack
Find the largest rectangle area in a histogram using a monotonic stack
Arrange deck so cards are revealed in increasing order using queue simulation
Find the maximum score of a jump game using a queue
Find maximum in each sliding window using monotonic deque
Find the maximum value of equation using a queue
Sort an array of 0s, 1s, and 2s using the quickselect algorithm
Find the kth largest element in an array using a min-heap
Find the insertion position of a target in a sorted array using binary search
Find target in rotated sorted array using modified binary search
Find the peak element in a sorted array using binary search
Find the minimum element in a rotated sorted array using binary search
Find target in sorted 2D matrix using binary search
Generate all subsets using recursive backtracking with decision tree
Generate all permutations by choosing unused elements recursively
Traverse tree level by level using BFS and queue
Traverse tree right side view using BFS and queue
Traverse tree level by level in zigzag pattern using BFS and queue
Connect nodes at same level using BFS with queue
Traverse tree preorder using DFS and stack
Count downward paths that sum to target using prefix sums and DFS
Traverse tree inorder using DFS and stack
Find the minimum distance between any two nodes in a BST
Check if a binary tree satisfies BST properties using recursive DFS
Find the kth smallest element in a BST using iterative inorder traversal
Traverse tree postorder using DFS and stack
Invert a binary tree using DFS and stack
Find the diameter of a binary tree using recursion
Find the lowest common ancestor of two nodes in a binary tree using recursion
Flatten tree to right-skewed linked list in-place using Morris Traversal
Distribute coins to each node in a binary tree so that every node has exactly one coin
Find maximum path sum in tree where path can start and end at any node
Trim BST to range [low, high] using recursive pruning and restructuring
Generate product suggestions for each prefix using binary search
Find all words from dictionary in board using Trie and DFS backtracking
Find furthest building reachable with bricks and ladders using min-heap
Maximize capital by selecting k most profitable projects using max-heap
Find k closest points to origin using max-heap to track distances
Merge all overlapping intervals on a timeline
Find minimum arrows needed to burst all balloons using greedy algorithm
Find kth smallest element using binary search on value range
Find minimum jumps to reach the end using greedy BFS approach
Find starting gas station to complete circular route using greedy algorithm
Count separate islands in a 2D grid using BFS flood-fill
Find all nodes exactly K edges away from target using BFS with parent links
Find minimum time for all oranges to rot using multi-source BFS
Find shortest word transformation sequence using BFS
Find valid course order using DFS topological sort on prerequisite graph
Count connected components in adjacency matrix using DFS
Find the number of ways to climb to the top of the stairs
Find the minimum cost to climb to the top of the stairs
Find maximum money to rob from houses using dynamic programming
Find maximum money to rob from houses in a circle using dynamic programming
Find length of longest subsequence common to both strings using dynamic programming
Count number of ways to make amount using coins with dynamic programming
Find path with minimum sum from top-left to bottom-right in grid
109 of 109 algorithms shown