Home  >  Q&A  >  body text

java 一个数组中m个不同的数 需要分成n组

java 一个数组中m个不同的数 需要分成n组,比如{1,5,7}分成2组:{1}{5,7};{5}{1,7};{7}{1,5},m>=n,这里n=2比较好举例,实际上是n>2情况居多,请大神支招java实现!!!求代码!!!

伊谢尔伦伊谢尔伦2743 days ago585

reply all(2)I'll reply

  • 大家讲道理

    大家讲道理2017-04-18 10:52:45

    This is a permutation and combination problem

    reply
    0
  • PHPz

    PHPz2017-04-18 10:52:45

    Yes, this is the problem of dividing m by n. There is currently an implementation of m taking n, but the problem of dividing m by n has not found a Java implementation version. Please give me the code to implement it! !

    reply
    0
  • Cancelreply