📣 黑五价提前开抢|VIP一年通行证5折,蓝莓、Offer多多同步特惠
楼主: smallsimple
跳转到指定楼层
上一主题 下一主题
收起左侧

FB电面,水过

🔗
 楼主| smallsimple 2015-4-2 03:13:50 | 只看该作者
全局:
seabiscuit119 发表于 2015-4-2 03:00
Will have second interview on Friday. Hope to meet Leetcode problems....

好像最近问的题都是leetcode上的。祝好运。
回复

使用道具 举报

全局:
smallsimple 发表于 2015-4-2 03:13
好像最近问的题都是leetcode上的。祝好运。

Thx!!  // size
回复

使用道具 举报

🔗
siren01 2015-4-2 05:33:42 | 只看该作者
全局:
smallsimple 发表于 2015-4-2 01:50
电面完第二天中午收到邮件说晚上打个电话聊聊,让确认下时间。然后晚上电话过来就说给offer了。你也有面 ...

楼主好人,求combinationSum的非递归解法,求code
回复

使用道具 举报

🔗
crazybadboy 2015-4-2 10:55:17 | 只看该作者
全局:
请问楼主,非递归的是combination sum I 还是combination sum II?
回复

使用道具 举报

🔗
haoxuango 2015-4-2 11:00:43 | 只看该作者
全局:
楼主一面二面隔了多久
回复

使用道具 举报

🔗
yuxrose 2015-4-2 11:04:49 | 只看该作者
全局:
siren01 发表于 2015-4-2 05:33
楼主好人,求combinationSum的非递归解法,求code

求code + 1, lz 好人!
回复

使用道具 举报

🔗
ppips 2015-4-2 11:18:08 | 只看该作者
全局:
siren01 发表于 2015-4-2 05:33
楼主好人,求combinationSum的非递归解法,求code

仅供参考
  1. public List<List<Integer>> combinationSum(int[] candidates, int target) {
  2.         Arrays.sort(candidates);
  3.         List<List<List<Integer>>> dp = new ArrayList<List<List<Integer>>>();
  4.         for (int i = 1; i <= target; i++) {
  5.             List<List<Integer>> list_i = new ArrayList<List<Integer>>();
  6.             for (int j = 0; j < candidates.length && candidates[j] <= i; j++) {
  7.                 if (i == candidates[j])
  8.                     list_i.add(Arrays.asList(candidates[j]));
  9.                 else {
  10.                     for (List<Integer> l : dp.get(i - 1 - candidates[j])) {
  11.                         if (candidates[j] <= l.get(0)) {
  12.                             List<Integer> tmp = new ArrayList<Integer>();
  13.                             tmp.add(candidates[j]);
  14.                             tmp.addAll(l);
  15.                             if (!list_i.contains(tmp))
  16.                                 list_i.add(tmp);
  17.                         }
  18.                     }
  19.                 }
  20.             }
  21.             dp.add(list_i);
  22.         }
  23.         return dp.get(target - 1);
  24.     }
复制代码
回复

使用道具 举报

🔗
anastasia22 2015-4-2 11:21:44 | 只看该作者
全局:
不用onsite就拿到offer了啊,双
回复

使用道具 举报

🔗
readman 2015-4-2 12:40:10 | 只看该作者
全局:
您好!
本帖隐藏的内容需要积分高于 100 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 100 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限 或 查看其他获取积分的方式
Unlock interview details and practice with AI
Popular Interview Questions from Top Companies
回复

使用道具 举报

🔗
siren01 2015-4-2 12:45:07 | 只看该作者
全局:

谢谢共享,看完后有一点,你这外循环从1迭代到target,复杂度还是很高的...三个List吓人
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册账号
隐私提醒:
  • ☑ 禁止发布广告,拉群,贴个人联系方式:找人请去🔗同学同事飞友,拉群请去🔗拉群结伴,广告请去🔗跳蚤市场,和 🔗租房广告|找室友
  • ☑ 论坛内容在发帖 30 分钟内可以编辑,过后则不能删帖。为防止被骚扰甚至人肉,不要公开留微信等联系方式,如有需求请以论坛私信方式发送。
  • ☑ 干货版块可免费使用 🔗超级匿名:面经(美国面经、中国面经、数科面经、PM面经),抖包袱(美国、中国)和录取汇报、定位选校版
  • ☑ 查阅全站 🔗各种匿名方法

本版积分规则

>
快速回复 返回顶部 返回列表