Combinatorics
Everything on SkillVeris tagged Combinatorics — collected across the glossary, study notes, blog, and cheat sheets.
16 resources across 1 library
Interview Questions(16)
How Does the Next Permutation Algorithm Work?
The next permutation algorithm rearranges a sequence in place into the lexicographically next greater permutation using O(n) time and O(1) extra space, by find…
What is the Boolean Parenthesization Problem?
The boolean parenthesization problem counts, given a string of boolean operands (T/F) separated by operators (AND, OR, XOR), how many ways parentheses can be i…
What are Catalan Numbers and Their Applications?
Catalan numbers are a sequence C(n) = (2n choose n) / (n+1), computed recursively as the sum over i from 0 to n-1 of C(i)*C(n-1-i), and they count a surprising…
What is the Unique Paths Problem?
The unique paths problem counts how many distinct routes exist from the top-left to the bottom-right of an m x n grid when only right or down moves are allowed…
How to Solve Permutation and Combination Problems
Permutations count arrangements where order matters (nPr = n!/(n−r)!), while combinations count selections where order does not matter (nCr = n!/(r!(n−r)!)); t…
How to Solve Probability Problems
Probability of an event is favorable outcomes divided by total possible outcomes, P(E) = n(E)/n(S), and most problems are solved by carefully counting both usi…
How to Count the Factors of a Number
The number of factors of N is found by writing its prime factorization N = p1^a1 × p2^a2 × ... × pk^ak, then multiplying (a1+1)(a2+1)...(ak+1) — one more than…
How to Solve Probability Problems on Playing Cards
A standard deck has 52 cards in 4 suits of 13 ranks, so any card-probability question reduces to counting favorable cards over 52 (or over nCr combinations whe…
How to Solve Probability Problems on Dice
A single fair die has 6 equally likely outcomes, and rolling n dice together creates a sample space of 6^n equally likely ordered outcomes, so every dice probl…
How to Solve Probability Problems With Replacement
With replacement means each item drawn is put back before the next draw, so the total pool and every probability stay identical across draws, making successive…
How to Solve Probability Problems Without Replacement
Without replacement means each drawn item is kept out of the pool, so both the total count and the favorable count shrink after every draw, making successive d…
How to Solve Permutation with Repetition Problems
When items may repeat and each position is filled independently from the same pool of n choices, the count of ordered arrangements of length r is simply n^r, n…
How to Solve Committee Selection Combination Problems
Committee selection problems are pure combinations — nCr — because a committee is defined by which people are in it, not by any internal order, and constrained…
How to Solve Circular Permutation Problems
Arranging n distinct people around a circle gives (n−1)! arrangements rather than n!, because rotating everyone by one seat produces the same relative arrangem…
How to Arrange Letters of a Word (Permutation)
The number of distinct arrangements of a word with n letters, where some letters repeat, is n! divided by the factorial of each repeated letter’s count — n!/(p…
How to Solve Combinations with Restrictions
Combinations with restrictions — certain items forced in, forced out, or mutually exclusive — are solved by breaking the unrestricted nCr count into smaller in…