##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
Learn algorithms step-by-step. Each tutorial includes explanations, code implementations, and practice problems.
Factorial with Modular Arithmetic
Euclidean Algorithm for GCD
Fast Exponentiation Binary Exponentiation
Sieve of Eratosthenes
Binomial Coefficient nCr mod p
Modular Multiplicative Inverse
Dynamic Programming: Memoization
Unbounded Knapsack
Edit Distance measures the minimum number of single-character operations needed to transform one string into another. You have operations available:
The Knapsack problem asks: given items, each with a weight and value, what's the maximum value you can carry in a bag with capacity ?
A subsequence is a sequence you can derive from another by deleting zero or more elements without changing the order of remaining elements. For example, "ACE"...
The Longest Increasing Subsequence LIS problem asks for the length of the longest subsequence where each element is strictly greater than the previous one.
The 2D Prefix Sum technique extends the 1D prefix sum to matrices, enabling range sum queries after preprocessing.
Kadane's Algorithm
Next Greater Element Monotonic Stack
Prefix Sum
Two Pointers Technique
The Range Minimum Query RMQ problem asks: given an array and multiple queries, find the minimum element in a specified range for each query.
Segment Tree
Trie Prefix Tree
Union-Find also called Disjoint Set Union or DSU helps you track elements partitioned into non-overlapping sets. You can perform operations: find tells you...