Practice Discrete Math

Algorithms / Combinatorics Interview

Least You Need to Know: Combinatorics Patterns: Choose vs Arrange, Complement Counts, and Stars and Bars

Interview counting often comes down to a modeling choice: are you choosing a set, arranging an ordered sequence, counting the easier complement, or distributing identical units across labeled bins? The hard part is recognizing which model matches the wording.

The least you need to know

Key notation

C(n, k) number of `k`-element subsets of `n` distinct items
P(n, k) number of ordered length-`k` selections from `n` distinct items
x_1 + ... + x_k = n distribution model for stars and bars

Tiny worked example

  • If a prompt asks for a 3-person committee from 10 students, order does not matter, so choose with `C(10, 3)`.
  • If it asks for gold, silver, and bronze from the same 10 students, the positions differ, so order matters and you use an arrangement count.

Common mistakes

How to recognize this kind of problem

Start practice