Combinatorics -> Counting Basics
Factorials, binomials, arrangements, stars and bars, and the basic models that recur across counting problems.
- Topic slug:
combinatorics/counting-basics
- Tutorial page: Open tutorial
- Ladder page: Open ladder
- Repo problems currently tagged here:
2
- Repo companion pages:
0
- Curated external problems:
13
Microtopics
- permutations
- combinations
- binomial
- factorials
- pascal-triangle
- catalan
Learning Sources
Practice Sources
Follow-Up Reading
Curated External Problems
Core
| Problem |
Source |
Difficulty |
Context |
Style |
Prerequisites |
Tags |
Why it fits |
| Bit Strings |
CSES |
Easy |
Basic Counting, Mod Arithmetic |
- |
- |
Powers Of Two |
The simplest counting-by-choices starter. |
| Choose Cards 1 |
AtCoder |
Easy |
Pair-Counting |
Implementation; Counting |
Basic Counting; Frequency Arrays |
Pairs |
A very direct counting warm-up with only frequency bookkeeping. |
| Choose Cards 3 |
AtCoder |
Easy |
Pair-Counting |
Implementation; Counting |
Frequency Arrays; Complement Counting |
Two-Sum; Frequency Counting |
A great basic complement-counting exercise with a fixed target sum. |
| Combination Easy |
AtCoder |
Easy |
Binomial-Coefficients |
Math |
Factorials; Combinations |
Ncr |
A pure combinatorics starter that isolates nCr without any hidden twists. |
| Two Knights |
CSES |
Easy |
- |
- |
- |
Board Counting; Pair Counting; Formula |
Classic counting-by-cases on a board. |
| Binomial Coefficients |
CSES |
Medium |
Modular-Arithmetic |
Math; Precomputation |
Factorials; Modular Inverse |
Ncr; Factorials; Modular Inverse |
The standard modular-combinatorics benchmark for factorial precomputation. |
| Choose Cards 2 |
AtCoder |
Medium |
Subset-Counting |
Search; Counting |
Subset Enumeration; Sum Constraints |
Meet-In-The-Middle |
A classic counting-by-subsets problem that sits between brute force and combinatorics. |
| Creating Strings II |
CSES |
Medium |
Multiset Permutations |
Math; Precomputation |
Multiset Counting; Modular Arithmetic |
Factorials |
A textbook multinomial-counting problem with duplicate letters. |
| Two Sets II |
CSES |
Medium |
DP |
- |
- |
Partitions; Subset Sum; Mod Arithmetic |
Nice introductory partition-counting problem. |
Practice
| Problem |
Source |
Difficulty |
Context |
Style |
Prerequisites |
Tags |
Why it fits |
| Christmas Party |
CSES |
Medium |
Derangements |
Combinatorics; DP |
Basic Counting; Inclusion-Exclusion |
Derangements; Inclusion-Exclusion |
A classic derangement/counting problem that is good practice for constrained permutations. |
| Distributing Apples |
CSES |
Medium |
Stars-And-Bars |
Math; Combinatorics |
Combinations |
Compositions; Combinations; Mod Arithmetic |
A canonical stars-and-bars problem and a clean step toward distributions with constraints. |
Stretch
| Problem |
Source |
Difficulty |
Context |
Style |
Prerequisites |
Tags |
Why it fits |
| Counting Necklaces |
CSES |
Hard |
Group-Actions |
Combinatorics |
Modular Arithmetic |
Burnside; Pólya |
A more advanced counting benchmark that moves from raw counting into symmetry. |
| Counting Permutations |
CSES |
Hard |
Permutation-Counting, Inclusion-Style Counting |
DP; Combinatorics |
Inclusion-Exclusion Mindset |
Permutations; Adjacency Constraints; Adjacency Restriction; Beautiful Permutations |
A stronger permutation-counting problem with a clean but nontrivial constraint. |
Repo Problems
| Code |
Title |
Fit |
Difficulty |
Pattern |
Note |
Solution |
DISTRIBUTINGAPPLES |
Distributing Apples |
primary |
medium |
stars and bars; single binomial query; factorial precompute |
Note |
Code |
VOSFENCE |
Xay hang rao |
secondary |
hard |
bounded compositions; run decomposition; gap distribution |
Note |
Code |
Regeneration
python3 scripts/generate_problem_catalog.py