由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - 问个google面试题
相关主题
求问一道MS面试题partition array problem
问一道算法题再来讨论一个题!
问个MS 老问题Quick Sort的partition问题
~~~~~~~~问个G家的题~~~~~~~~~~~请教一道算法题
问个MapReduce面试题分配打印机作业的算法题
问一道kth smallest element的题目一道热门的 Google 面试题
也来攒下人品,L面经问道面试题
请教一下palindrome partitioning用memoization的问题Quick sort为什么需要logN的memory?
相关话题的讨论汇总
话题: set话题: largest话题: smallest话题: picking话题: careercup
进入JobHunting版参与讨论
1 (共1页)
B*******1
发帖数: 2454
1
careercup上面看的
Partition a set of numbers into two such that difference between their sum
is minimum, and both sets have equal number of elements.
For example: {1, 4, 9, 16} is partitioned as {1,16} and {4,9} with diff = 17
-13=4.
Does greedy work here? First sorting, and then picking smallest and largest
to fall in set 1, and picking 2nd smallest and 2nd largest to fall in set 2.
I was asked to prove which I failed :(
g*****i
发帖数: 2162
2
partition problem变种,应该可以用subset problem的dp solution来做,wiki上说的.
greedy方法的approximation factor是4/3,很接近了.
楼主我觉得你老是钻研这种难题没啥必要,面试这种题目出现的概率极低,出了面试官也
会引导你的.
B*******1
发帖数: 2454
3
没有研究,careercup上的google的怎么都这么难。
y*******g
发帖数: 6599
4
careercup 估计是假题目吧
我觉得glassdoor好的多,

【在 B*******1 的大作中提到】
: 没有研究,careercup上的google的怎么都这么难。
B*******1
发帖数: 2454
5
是啊? 而且看了这几个我贴的这么难的都是google india的。
D*******e
发帖数: 151
6
有人跟我说,随机置换两边的数(只要让结果变好就换)是最快的
c****p
发帖数: 6474
7
greedy,容易达到local optimal.

【在 D*******e 的大作中提到】
: 有人跟我说,随机置换两边的数(只要让结果变好就换)是最快的
i**d
发帖数: 357
8
这应该是一个dp题。
等价于 在数组中找出 len/2个数,使得和在不大于 sum/2时,最大化.
c****x
发帖数: 61
9
必然是假的
子集和(NPC) => 二等分 => 二等分且两边元素个数相等 => minimum difference is 0
in this problem

17
largest
2.

【在 B*******1 的大作中提到】
: careercup上面看的
: Partition a set of numbers into two such that difference between their sum
: is minimum, and both sets have equal number of elements.
: For example: {1, 4, 9, 16} is partitioned as {1,16} and {4,9} with diff = 17
: -13=4.
: Does greedy work here? First sorting, and then picking smallest and largest
: to fall in set 1, and picking 2nd smallest and 2nd largest to fall in set 2.
: I was asked to prove which I failed :(

f****4
发帖数: 1359
10
Genetic algorithm 就干这个事情的

【在 D*******e 的大作中提到】
: 有人跟我说,随机置换两边的数(只要让结果变好就换)是最快的
1 (共1页)
进入JobHunting版参与讨论
相关主题
Quick sort为什么需要logN的memory?问个MapReduce面试题
The Partition Puzzle问一道kth smallest element的题目
问一个quick sort partition的问题, 二爷请进也来攒下人品,L面经
[合集] 问一个微软面试题请教一下palindrome partitioning用memoization的问题
求问一道MS面试题partition array problem
问一道算法题再来讨论一个题!
问个MS 老问题Quick Sort的partition问题
~~~~~~~~问个G家的题~~~~~~~~~~~请教一道算法题
相关话题的讨论汇总
话题: set话题: largest话题: smallest话题: picking话题: careercup