同步操作将从 Gitee 极速下载/javascript-algorithms 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
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.
This is how lotteries work. The numbers are drawn one at a time, and if we have the lucky numbers (no matter what order) we win!
No Repetition: such as lottery numbers (2,14,15,27,30,33)
Number of combinations
where n
is the number of things to choose from, and we choose r
of them,
no repetition, order doesn't matter.
It is often called "n choose r" (such as "16 choose 3"). And is also known as the Binomial Coefficient.
Repetition is Allowed: such as coins in your pocket (5,5,5,10,10)
Or let us say there are five flavours of ice cream:
banana
, chocolate
, lemon
, strawberry
and vanilla
.
We can have three scoops. How many variations will there be?
Let's use letters for the flavours: {b, c, l, s, v}
.
Example selections include:
{c, c, c}
(3 scoops of chocolate){b, l, v}
(one each of banana, lemon and vanilla){b, v, v}
(one of banana, two of vanilla)Number of combinations
Where n
is the number of things to choose from, and we
choose r
of them. Repetition allowed,
order doesn't matter.
Permutations cheat sheet
Combinations cheat sheet
Permutations/combinations algorithm ideas.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。