摘要:
题目:将一个数组分成两部分,不要求两部分所包含的元素个数相等,要求使得这两个部分的和的差值最小。比如对于数组{1,0,1,7,2,4},可以分成{1,0,1,2,4}和{7},使得这两部分的差值最小。 思路:这个问题可以转化为求数组的一个子集,使得这个子集中的元素的和尽可能接近sum/2,其中sum 阅读全文
posted @ 2018-05-24 20:54
ranjiewen
阅读(13036)
评论(0)
推荐(0)
摘要:
Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array. Example 1: Input: [3,0,1] Output 阅读全文
posted @ 2018-05-24 20:22
ranjiewen
阅读(166)
评论(0)
推荐(0)
摘要:
题目 解析 C++ class ScaleSort { public: vector sortElement_1(vector A, int n, int k) { // write code here sort(A.begin(), A.end()); return A; } void headA 阅读全文
posted @ 2018-05-24 18:03
ranjiewen
阅读(235)
评论(0)
推荐(0)


浙公网安备 33010602011771号