Arrays & Hashing
Core data structures for data organization
Contains Duplicate
Check if any value appears at least twice
Two Sum (Sorted)
Find two numbers that add up to target
Remove Duplicates
Remove duplicates from sorted array in-place
Move Zeros
Move all zeros to end while maintaining order
Kadane's Algorithm
Maximum subarray sum
Rotate Array
Rotate array by k positions
Sort 0s, 1s, 2s
Dutch National Flag - sort array of 0, 1, 2
Majority Element (n/2)
Boyer-Moore voting algorithm
Pascal's Triangle Row
Generate nth row of Pascal triangle
Find Duplicate Number
Floyd's cycle detection for duplicates
Grid Unique Paths
Count paths in m x n grid
Merge Overlapping Intervals
Merge overlapping intervals
Longest Consecutive Sequence
Find longest consecutive elements
4-Sum
Find quadruplets summing to target
Rotate Matrix
Rotate N x N matrix 90 degrees
Next Permutation
Next lexicographically greater permutation
Merge Sorted Arrays
Merge two sorted arrays without extra space
Majority Element II
Find elements > n/3 times
Repeat and Missing Number
Find duplicate and missing in 1..N
Largest Subarray with K Sum
Longest subarray summing to K
Count Subarrays with XOR K
Count subarrays having XOR K
Pascal Triangle
Generate Pascal Triangle rows
Stock Buy and Sell
Max profit from single buy-sell
Rotate Matrix 90°
Rotate NxN matrix clockwise
Inversion Count
Count inversions using merge sort
Pow(x, n)
Calculate x^n efficiently
Reverse Pairs
Count pairs where i<j and a[i]>2*a[j]
Advanced Matrix
2D array manipulation and traversal
Binary Search Variants
Beyond basic binary search
Binary Search
Find target in sorted array
First Occurrence
Find first occurrence of target
Last Occurrence
Find last occurrence of target
Peak Element
Find element greater than neighbors
Search in Rotated Array
Binary search in rotated sorted array
N-th Root of Integer
Find integer n-th root using binary search
Single Element in Sorted Array
Find element that appears once
Allocate Minimum Pages
Minimize max pages allocated to student
Lower Bound
Find first element >= target
Upper Bound
Find first element > target
Search Insert Position
Find index to insert target
Count Occurrences
Count occurrences in sorted array
Square Root
Find integer square root
Sorting Algorithms
Divide-and-conquer and stability
Bubble Sort
Simple comparison-based sort
Selection Sort
Select minimum and place
Insertion Sort
Build sorted array one item at a time
Quick Sort
Partition-based divide and conquer
Counting Sort
Non-comparison linear time sort
Recursion & Backtracking
Mind-bending recursive patterns
Factorial
Classic recursion example
Fibonacci
Tree recursion example
Power (Fast)
Calculate x^n efficiently
Generate Subsets
Generate all subsets of array
Sum of Array (Recursive)
Sum array elements recursively
Subset Sum
Check if subset with given sum exists
Combination Sum I
Find combinations that sum to target (reuse allowed)
Combination Sum II
Find combinations that sum to target (no reuse)
Palindrome Partitioning
Count palindrome partitions of string
N-Queens Problem
Place N queens on NxN board safely
Print All Subsequences
Generate all subsequences of a string or array
Print All Permutations
Generate all possible orderings
Subsets II (Dupes)
Unique subsets with duplicate elements
Sudoku Solver
Fill 9x9 grid satisfying rules
Word Search
Find word in 2D grid
Stack Algorithms
Hidden control flow made explicit
Valid Parentheses
Check if parentheses are balanced
Next Greater Element
Find next greater element for each
Stock Span
Days before with lower price
Min Stack
Stack with O(1) getMin
Sliding Window Maximum
Max in each window of size k
Largest Rectangle Histogram
Find largest rectangle in histogram
Next Smaller Element
Find next smaller element for each
Sort a Stack
Sort stack using only stack operations
Stack using Single Queue
Implement Stack using one Queue
Queue using Two Stacks
Implement Queue using two Stacks
Rotten Oranges (BFS)
Find time to rot all oranges
Celebrity Problem
Find celebrity in a party
Max of Min in Windows
Maximum of minimums for each window size
Linked List
Pointer manipulation and traversal
Reverse Linked List
Reverse a singly linked list
Detect Cycle (Floyd's)
Detect if a linked list has a cycle
Reverse Array
Simulate linked list reversal
Floyd's Cycle Detection
Detect cycle using slow/fast pointers
Merge Sorted Lists
Merge two sorted linked lists
Find Middle Element
Find middle using slow/fast pointers
Remove N-th from End
Remove N-th node from end of list
Cycle Start Point
Find where cycle begins
LinkedList Palindrome
Check if list is palindrome
Rotate List
Rotate linked list to the right by k places
Intersection of Two Lists
Find node where two lists intersect
Add Two Numbers as LL
Add numbers represented as linked lists
Delete Node O(1)
Delete node without head reference
Reverse K-Group
Reverse nodes in groups of k
Tree Algorithms
Hierarchy and recursion combined
Tree Height
Calculate height of binary tree
Tree Sum
Sum all nodes in binary tree
Count Nodes
Count nodes in binary tree
Maximum in Tree
Find maximum value in tree
Morris Inorder Traversal
O(1) space traversal using threading
Diameter of Binary Tree
Longest path between any two nodes
Symmetric Tree
Check if tree is mirror of itself
Check Balanced Tree
Check if tree is height balanced
Left View of Tree
First node at each level
Level Order Spiral
Zig-zag level order traversal
Binary Search Tree
Ordered hierarchical data
Graph Algorithms
Real-world systems thinking
DFS (Simple)
Depth-first search traversal
Level Order Count
BFS level-by-level traversal
Path Exists
Check if path exists between nodes
Number of Islands
Count connected components of 1s
Rotting Oranges
Min minutes until all oranges rot
Course Schedule
Can all courses be finished?
Dijkstra's Algorithm
Shortest path from source to all vertices
Bellman-Ford Algorithm
Shortest path with negative weights
Floyd-Warshall Algorithm
All pairs shortest path
Cycle Detection (DFS)
Detect cycle in directed graph
Bipartite Check
Check if graph is bipartite
Dynamic Programming
Where visualization is GOLD
Fibonacci (DP)
Fibonacci with memoization
Climbing Stairs
Count ways to climb n stairs
Min Cost Climbing
Min cost to reach top of stairs
Coin Change (Count)
Count ways to make amount
House Robber
Max sum of non-adjacent elements
Longest Increasing Subsequence
Length of LIS in array
House Robber II
Circular houses - first and last adjacent
Minimum Path Sum
Min sum path from top-left to bottom-right
Word Break
Can string be segmented into dictionary words
Unique Paths II
Grid with obstacles
Greedy Algorithms
Why 'local' sometimes works
Activity Selection
Maximum non-overlapping activities
Jump Game
Can you reach the last index?
Gas Station
Find starting station for circular trip
Best Time to Buy & Sell
Maximum profit from stock
Job Sequencing
Maximize profit with deadlines
Fractional Knapsack
Max value with partial items allowed
Minimum Platforms
Min platforms for railway station
Jump Game II
Minimum jumps to reach end
Candy Distribution
Min candy with rating constraints
String Algorithms
Text processing patterns
Reverse String
Reverse characters in place
Max Consecutive Ones
Find longest consecutive 1s
Longest Common Prefix
Find common prefix of strings
Check Anagram
Check if two strings are anagrams
3 Sum
Find triplets that sum to target
Trapping Rainwater
Calculate trapped water
Longest Substring (Unique)
Longest substring without repeating chars
Longest Common Subsequence
Find length of LCS
Longest Palindromic Substring
Find longest palindrome in string
Edit Distance
Min operations to convert word1 to word2
Reverse Words in String
Reverse words keeping word order
ATOI Implementation
String to Integer conversion
KMP Algorithm
Knuth-Morris-Pratt Pattern Searching
Roman to Integer
Convert Roman numeral to integer
Implement strStr()
Find substring index
Compare Version Numbers
Compare two version strings
Count and Say
Generate sequence from previous term
Longest Substring K Distinct
Substr with at most k distinct chars
Check String Rotation
Check if s2 is rotation of s1
Min Chars for Palindrome
Min chars added at front to make palindrome
Heap Algorithms
Priority queue and heap-based solutions
Heap Sort
Sort array using a heap data structure
K Largest Elements
Find the k largest elements in an array
Kth Smallest Element
Find the kth smallest element in an array
K Most Frequent Elements
Find k most frequent elements
Min Heap Construction
Build a Min Heap from array
Max Heap Construction
Build a Max Heap from array
Connect Ropes Cost
Min cost to connect ropes
Last Stone Weight
Smash heaviest stones
Median of Data Stream
Find median in running stream
Graph Traversals
BFS and DFS graph exploration algorithms
Advanced Cache
LRU and other cache implementations
