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

Google Onsite,从HR反应来看要挂了。。。

🔗
hzyslddm 2016-2-24 03:25:38 | 只看该作者
全局:
求问LZ第三轮要求的最大值是指的路径之和的最大值吗?比如1->2->3, 从1到3路径值是2,还是1+2+3?如果计算路径考虑路径的权重,那BFS应该做不了

补充内容 (2016-2-24 03:28):
还有就是goal是以什么形式给出的?比如一个集合包含一些数值,矩阵里面的value在集合里面,就是goal这样吗?谢谢LZ分享啦~
回复

使用道具 举报

🔗
panlong222 2016-2-24 10:43:12 | 只看该作者
全局:
starcroce 发表于 2016-2-23 01:03
强行问啊,绕弯子累不累啊。。。can i have some feedback?

牛逼,简单粗暴有效!            
回复

使用道具 举报

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

使用道具 举报

🔗
hzyslddm 2016-2-24 15:12:14 | 只看该作者
全局:
starcroce 发表于 2016-2-24 14:05
跟路径和什么的没关系,就是找能到所有goal的位置中的最大值,输入么就是一个矩阵和一个goal的array,arr ...

好哒,谢谢分享~祝offer多多啦
回复

使用道具 举报

🔗
bobzhang2004 2016-3-5 06:32:12 | 只看该作者
全局:
写了下第四轮
  1. public class PermutationIV {

  2.         public static void main(String[] args) {
  3.                 int[] arr = {1, 2, 3, 4, 5, 6};
  4.                 List<List<Integer>> res = getAllPermutations(arr, 3);
  5.                 for (List<Integer> list : res) {
  6.                         for (int i : list) {
  7.                                 System.out.print(i);
  8.                         }
  9.                         System.out.println();
  10.                 }
  11.         }
  12.         public static List<List<Integer>> getAllPermutations(int[] arr, int k) {
  13.                 List<List<Integer>> res = new ArrayList<List<Integer>>();
  14.                 if (arr == null || arr.length == 0) {
  15.                         return res;
  16.                 }
  17.                 List<List<Integer>> nums = new ArrayList<List<Integer>>();
  18.                 int i = 0;
  19.                 while (i < arr.length) {
  20.                         List<Integer> list = new ArrayList<Integer>();
  21.                         for (int j = 0; j < arr.length / k; j++) {
  22.                                 list.add(arr[i++]);
  23.                         }
  24.                         nums.add(list);
  25.                 }
  26.                 helper(res, nums, new ArrayList<Integer>(), 0);
  27.                 return res;
  28.         }

  29.         private static void helper(List<List<Integer>> res, List<List<Integer>> nums, ArrayList<Integer> list,int pos) {
  30.                 if (pos == nums.size()) {
  31.                         res.add(new ArrayList<Integer>(list));
  32.                         return;
  33.                 }
  34.                
  35.                 for (int i = 0; i < nums.get(pos).size(); i++) {
  36.                         list.add(nums.get(pos).get(i));
  37.                         helper(res, nums, list, pos + 1);
  38.                         list.remove(list.size() - 1);
  39.                 }
  40.         }
  41. }
复制代码
回复

使用道具 举报

🔗
bobzhang2004 2016-3-5 10:57:49 | 只看该作者
全局:
starcroce 发表于 2016-2-5 14:48
比如两份HTML:
hello world
hello world

这个题就是先分别loop得到string, 然后再比较?
回复

使用道具 举报

🔗
bobzhang2004 2016-3-5 10:58:08 | 只看该作者
全局:
请问“有面值1, f1, f2, .., fn 的硬币无限个,组成给定的 k 最少需要多少硬币”这个题是怎么做的呢?
回复

使用道具 举报

🔗
 楼主| starcroce 2016-3-9 05:35:36 | 只看该作者
全局:
bobzhang2004 发表于 2016-3-5 10:58
请问“有面值1, f1, f2, .., fn 的硬币无限个,组成给定的 k 最少需要多少硬币”这个题是怎么做的呢?

就是给定面值求最少硬币数的DP背包,很经典的题了,一般的题目是给定了面值了,这里就是用1, f1, f2, f3...代替了。。。
回复

使用道具 举报

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

本版积分规则

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