【发布时间】:2013-04-05 12:06:31
【问题描述】:
我需要找到以下方式给出的数据的组合,
jobs #ofIntervals
---- -------------
4 1
1 2
3 2
0 3
2 3
必须根据#ofIntervals 对给定作业进行组合设置。 输出可能的组合将影响职位的位置。如果有多个具有相同#ofIntervals 的工作,那么只有更改这些工作位置才会设置新工作。给定输入的可能结果应该是这样的,
combination-1: 4 1 3 0 2 // same as input
combination-2: 4 3 1 0 2 // here as job 3 and 1 have 2 #ofIntervals they make a new combination
combination-3: 4 1 3 2 0 // here as job 2 and 0 have 3 #ofIntervals they make a new combination
combination-4: 4 3 1 2 0
谁能帮我写一个代码或建议一个算法。
【问题讨论】:
-
你尝试了什么?
-
我尝试过使用树,但无法完成代码
标签: java arrays algorithm combinations