01 — Problem Directory

Data Structures & Algorithms

Complete catalog of 113 interactive algorithm visualizers. Browse by data structure category or filter by difficulty.

Showing 23 of 113 visualizers
AR
Arrays & Hashing
Easy
Check if Every Row and Column Contains All Numbers

An n x n matrix is valid if every row and every column contains all the integers from 1 to n (inclusive). Check validity using row and column hash sets.

ArrayHash TableMatrix
AR
Arrays & Hashing
Easy
Concatenation of Array

Given an integer array nums of length n, create and return an array ans of length 2n where ans[i] == nums[i] and ans[i + n] == nums[i] for 0 <= i < n.

ArraySimulationTwo Pointers
AR
Arrays & Hashing
Medium
Container With Most Water

Find two lines that together with the x-axis form a container containing the most water using an optimal O(n) two-pointer inward scan.

Two PointersArrayGreedy+2
AR
Arrays & Hashing
Easy
Contains Duplicate

Detect duplicate elements in an array using an instant-lookup hash set.

Hash SetLookupFrequency
AR
Arrays & Hashing
Easy
Design HashSet

Design a HashSet without using any built-in hash table libraries, demonstrating hashing (key % size) and collision resolution via separate chaining in dynamic buckets.

HashSetHashingSeparate Chaining+2
AR
Arrays & Hashing
Medium
Dutch National Flag (Sort Colors)

Sort an array of 0s, 1s, and 2s in-place in linear time using Dijkstra's 3-way partitioning Dutch National Flag algorithm.

Two PointersSortingArray+1
AR
Arrays & Hashing
Easy
Find Pivot Index

Find the leftmost pivot index where the sum of numbers strictly to the left equals the sum of numbers strictly to the right using prefix and suffix sums.

ArrayPrefix Sum
AR
Arrays & Hashing
Medium
Group Anagrams

Group strings together using sorted character keys in a hash map.

Hash MapSortingCategorization
AR
Arrays & Hashing
Easy
Valid Anagram

Check if two strings contain identical character frequency distributions.

Hash MapStringFrequency
AR
Arrays & Hashing
Easy
Island Perimeter

Scan a grid, add four sides for each land cell, and subtract two for each shared edge above or to the left.

ArrayMatrixCounting
AR
Arrays & Hashing
Medium
Longest Consecutive Sequence

Find length of longest contiguous integer streak in O(n) using a hash set.

Hash SetStreakO(n)
AR
Arrays & Hashing
Medium
Merge Sort (Sort an Array)

Sort an array of integers in ascending order using divide-and-conquer Merge Sort with O(n log n) time complexity.

Divide and ConquerMerge SortRecursion+2
AR
Arrays & Hashing
Easy
Merge Sorted Array

Merge two sorted integer arrays into nums1 as one sorted array using two pointers and an auxiliary merge buffer.

Two PointersArraySorting
AR
Arrays & Hashing
Easy
Merge Strings Alternately

Merge characters from word1 and word2 in alternating order, appending any remaining suffix characters.

Two PointersStringSimulation
AR
Arrays & Hashing
Easy
Move Zeroes

Move all zeros in an array to the end in-place while maintaining the relative order of the non-zero elements using two pointers.

Two PointersArrayIn-Place
AR
Arrays & Hashing
Medium
Range Sum Query 2D - Immutable

Precompute a 2D prefix sum matrix in O(m · n) time to evaluate any submatrix sum query in O(1) time using the 2D Inclusion-Exclusion Principle.

Prefix SumMatrixDesign+1
AR
Arrays & Hashing
Easy
Range Sum Query - Immutable

Precompute prefix sums in O(n) to evaluate contiguous subarray sum queries in constant O(1) time.

Prefix SumArrayDesign
AR
Arrays & Hashing
Easy
Squares of a Sorted Array

Square numbers and sort in O(n) time using opposing two pointers.

Two PointersSorted Array
AR
Arrays & Hashing
Medium
3Sum

Find all unique triplets that sum to zero with sorting and two pointers.

Two PointersSortingDuplicate Handling
AR
Arrays & Hashing
Easy
Two Sum

Find indices of two numbers that add up to target using a single-pass hash map.

Hash MapArrayComplement
AR
Arrays & Hashing
Medium
Two Sum II (Sorted Array)

Find two numbers in a 1-indexed sorted array that add up to a target number using opposing two pointers in O(n) time and O(1) space.

Two PointersArrayBinary Search+1
AR
Arrays & Hashing
Easy
Valid Palindrome II

Determine if a string can be a palindrome after deleting at most one character using two pointers.

Two PointersStringGreedy
AR
Arrays & Hashing
Medium
Valid Sudoku

Validate a 9x9 Sudoku board checking rows, columns, and 3x3 subgrids.

Hash SetMatrixValidation