Skip to content

【js】如何高效的实现从m中选n个数的条件组合函数 #26

@henryyohn

Description

@henryyohn

从m中选n个数出来按条件组合
1、考虑顺序和不考虑顺序
2、一个组合中,允许有重复元素和不允许有重复元素
如从0,1,2中选2个数
1、考虑顺序允许重复:[0,0],[0,1],[0,2],[1,1],[1,2],[2,2],[2,1],[2,0],[1,0]
2、考虑顺序不允许重复:[0,1],[0,2],[1,2],[2,1],[2,0],[1,0]
3、不考虑顺序允许重复:[0,0],[0,1],[0,2],[1,1],[1,2],[2,2]
4、不考虑顺序不允许重复:[0,1],[0,2],[1,2]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions