Skip to content

[js] 排列组合矩阵实现 #21

@VaJoy

Description

@VaJoy

有这么几个变量:

  • a 其值可能为 0、1
  • b 其值可能为 3、4、5
  • c 其值可能为 6、7

实现一个函数 getArranging 可以返回它们的可能值的排列组合二维数组:

function getArranging( ){
      //TODO - 返回参数的排列组合
}

var a = [0, 1];
var b = [3, 4, 5];
var c = [6, 7];

var ret = getArranging( a, b, c );
// ret 值为:
/**
[ [0,3,6], [0,3,7], [0,4,6], [0,4,7], [0,5,6], [0,5,7], [1,3,6], [1,3,7], [1,4,6], [1,4,7], [1,5,6], [1,5,7] ]
**/

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions