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

狗狗加面面经【2016-10-13】

🔗
 楼主| printf_ll 2016-10-14 23:45:15 | 只看该作者
全局:
hezhifeng850207 发表于 2016-10-14 23:01
第二题只能backtracking,不能用dp或者memorization?

它只要考虑到所有排列的情况就可以了吧,dp要存储什么呢?
回复

使用道具 举报

🔗
黄豆沙君 2016-10-14 23:52:11 | 只看该作者
全局:
printf_ll 发表于 2016-10-14 13:15
你怎么会认出我的!

因为!我聪明!
回复

使用道具 举报

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

评分

参与人数 1大米 +3 收起 理由
harrypotter + 3 回答的很好!

查看全部评分

回复

使用道具 举报

🔗
xuzonghan66 2016-10-19 15:48:47 | 只看该作者
全局:
第二题:

  1. public List<Integer> getNumbers(int[] digits, int maxNumber) {
  2.                 List<Integer> result = new ArrayList<Integer>();
  3.                 if(digits.length == 0) return result;
  4.                
  5.                 Arrays.sort(digits);
  6.                 Queue<Integer> queue = new LinkedList<Integer>();
  7.                 queue.add(0);
  8.                
  9.                 while(!queue.isEmpty()){
  10.                         int size = queue.size();
  11.                         for(int i = 0; i < size; i++){
  12.                                 int previous = queue.poll();
  13.                                 for(int j = 0; j < digits.length; j++){
  14.                                         int current = previous * 10 + digits[j];
  15.                                         if(current <= maxNumber && current != 0){
  16.                                                 queue.add(current);
  17.                                                 result.add(current);
  18.                                         }
  19.                                 }
  20.                         }
  21.                 }
  22.                
  23.                 if(digits[0] == 0) result.add(0, 0); // corner case when there is 0 in digits array
  24.                 return result;
  25.         }
复制代码
回复

使用道具 举报

🔗
jennyEternal 2016-10-20 12:17:03 | 只看该作者
本楼:
全局:
楼主加油!
回复

使用道具 举报

🔗
syjohnson 2016-10-31 09:14:30 | 只看该作者
全局:
请问bitmap是如何存储达到节省空间的呢
回复

使用道具 举报

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

使用道具 举报

🔗
zzgzzm 2016-10-31 10:01:20 | 只看该作者
全局:
第一题:若比较2个hashset是否时间复杂度就成了O(N1*N2)了?我是直接在一个hashset中看每个id是否在另外一个hashset中, O(N1+N2)
  1. vector<unordered_set<int>> getLeavingAndNew(unordered_set<int>& day1, unordered_set<int>& day2) {
  2.   vector<unordered_set<int>> res(2); // 0-index list for leaving employee
  3.                                      // 1-index list for new employee
  4.   for (int id : day1) if (!day2.count(id)) res[0].insert(id); // O(N1)
  5.   for (int id : day2) if (!day1.count(id)) res[1].insert(id); // O(N2)
  6.   return res;
  7. }
复制代码
回复

使用道具 举报

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

使用道具 举报

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

使用道具 举报

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

本版积分规则

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