摘要: 交换两个数组值使两个数组之差最小 有两个序列a,b,大小都为n,序列元素的值任意整数,无序; 要求:通过交换a,b 中的元素,使[序列a 元素的和]与[序列b 元素的和]之间的差最小。 例如: var a=[100,99,98,1,2, 3]; var b=[1, 2, 3, 4,5,40]; 假设 阅读全文
posted @ 2017-05-17 22:50 energy1989 阅读(110) 评论(0) 推荐(0) 编辑
摘要: public class Solution{ public List<List<Integer>> permutations(int[] arr){ List<List<Integer>> res = new ArrayList<List<Integer>>(); //corner if ( arr 阅读全文
posted @ 2017-05-17 15:27 energy1989 阅读(24) 评论(0) 推荐(0) 编辑
摘要: 问题: 给n个不同的正整数, 取m个数使得和为sum, 其中任意数可以重复取多次 例如:set [2, 3, 6, 7] and target 7, 结果有[7] ,[2,2,3] public class Solution { public List<List<Integer>> combinat 阅读全文
posted @ 2017-05-17 14:27 energy1989 阅读(33) 评论(0) 推荐(0) 编辑