由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - 请教几个问题
相关主题
a problem from leetcode: high efficiency algorithm for combinations problem继续咱人品求bless亚麻二面经
刚看了下shuffle算法。发现有个问题Combination Sum II哪里做错了
一道面试题看不懂关于结果除掉重复的问题请教
combinations 有没有 iterative的方法阿 ?请教一道CS常见题的解法
问个递归的问题CS: print all combination from an array
数组Shuffle 那道题generate unique integer ID from columns in SQL table
这题也可以DP 解吧?问一下shuffle card问题
请教leetcode Combination Sum II的code,谢谢。有人面了Amazon Intern的吗
相关话题的讨论汇总
话题: function话题: write话题: 10话题: integers话题: calling
进入JobHunting版参与讨论
1 (共1页)
A********3
发帖数: 45
1
1. Write a function that takes an array of five integers, each of which
is between 1 and 10, and returns the number of combinations of those
integers that sum to 15. For example, calling the function with the array [
1, 2, 3, 4, 5] should return 1, while calling it with [5, 5, 10, 2, 3]
should return 4 (5 + 10, 5 + 10, 5 + 5 + 2 + 3, 10 + 2 + 3). You may assume
that the input has already been validated. Show how you would test this
function.
2. Write a function to shuffle a deck of 52 c
v*****t
发帖数: 127
2
第一个回溯剪枝吧
第二个shuffle就用knuth好了。测试只有大量的shuffle很多次,然后看统计结果,比如每个位置上每张牌的等概率分布,位置上的相关性有些不太好测(比如说,你的shuffle算法很差,每次就是rotate一位),算一算不同位置上牌的相关性?或者就是每次算个inversion数来看看分布的情况,或者算算针对某一张牌看看他出现在哪些位置是否有随机性。反正就不停的想一些测试结果可以反映随机性的,估计面试官也不会是专门搞蒙特卡洛的。
第三个就完全不懂了。。。

[
assume
would

【在 A********3 的大作中提到】
: 1. Write a function that takes an array of five integers, each of which
: is between 1 and 10, and returns the number of combinations of those
: integers that sum to 15. For example, calling the function with the array [
: 1, 2, 3, 4, 5] should return 1, while calling it with [5, 5, 10, 2, 3]
: should return 4 (5 + 10, 5 + 10, 5 + 5 + 2 + 3, 10 + 2 + 3). You may assume
: that the input has already been validated. Show how you would test this
: function.
: 2. Write a function to shuffle a deck of 52 c

A********3
发帖数: 45
3
谢谢variant,顶上去,看看有没有对第三题有点想法地。
1 (共1页)
进入JobHunting版参与讨论
相关主题
有人面了Amazon Intern的吗问个递归的问题
这道题,怎么做呀?数组Shuffle 那道题
amazon 新鲜面筋这题也可以DP 解吧?
startup onsite求祝福 + 面经请教leetcode Combination Sum II的code,谢谢。
a problem from leetcode: high efficiency algorithm for combinations problem继续咱人品求bless亚麻二面经
刚看了下shuffle算法。发现有个问题Combination Sum II哪里做错了
一道面试题看不懂关于结果除掉重复的问题请教
combinations 有没有 iterative的方法阿 ?请教一道CS常见题的解法
相关话题的讨论汇总
话题: function话题: write话题: 10话题: integers话题: calling