- 给定数字数组 candidates, 和一个目标范围 [min, max] ,找出 candidates 中所有可以使数字和 >=min 且<=max 的组合。
例如: 输入: candidates = [10, 20, 20, 30, 40], [min, max] = [30, 50] 输出: [[10, 20], [10, 30], [10, 40], [10, 20, 20], [20, 20], [20, 30], [30], [40]]
- 给定数字数组 candidates, 和一个目标数 target ,另一个小于 target 的目标数 target1 , 找出 candidates 中所有可以使数字和 > target , 且拿掉任一一个数字后的数字和 < target , 且拿掉某一个数字后的数字和 <= target - target1 的组合。
例如: 输入: candidates = [10, 20, 20, 30], target = 45, target1 = 10 输出: [[20, 30], [10, 20, 20]]
以上都是我这边现实业务需要计算的场景, 我根据 leetcode 上的组合总和 II改了改算是勉强将第一个算法实现了
第二个算法实在是不会搞了