Resource · Guide or article
Combinations
Explains the difference between combinations and permutations and gives the counting formulas with and without repetition.
Reviewed
Open the original: Combinations (opens the original site in a new tab)Add to a roadmap
Keep this resource with a roadmap you follow. It appears as your own extra resource; the roadmap's steps don't change and it doesn't count toward your tracked steps.
Source content: English
When the order doesn't matter, it is a Combination. When the order does matter it is a Permutation. "My fruit salad is a combination of apples, grapes and bananas" We don't care what order the fruits are in, they could also be "bananas, grapes and apples" or "grapes, apples and bananas", its the same fruit salad.
PrepKit overview
PrepKit editors wrote and reviewed this overview from the source repository. It is not text from the resource itself.
- Suited to
- The source does not state a level
- Format
- Cheatsheet
What it covers
- Combinations without repetitions: the n choose r formula, illustrated with lottery numbers.
- Combinations with repetitions: choosing three scoops from five ice cream flavours.
- Cheatsheet section with overview images comparing both cases.
How to use it
PrepKit study advice, not a claim made by the source.
Count three-scoop selections from five flavours with and without repetition, then write code that lists them to confirm the counts.
Scope and limitations
Formulas and the cheatsheet are images only. No algorithm or code is described, and external links include the author's Medium cheat sheet.
Access and format
English README on GitHub, free to read, in the MIT-licensed trekhleb/javascript-algorithms repository.
Reviewed by PrepKit on Oct 2, 2026. Listing source commit: 85293e3e2b88
Evidence behind this overview
- src/algorithms/sets/combinations/README.md
Pages that include this
Get the PrepKit newsletter
Optional. You don't need it to use PrepKit.