楼主: shawlin
跳转到指定楼层
上一主题 下一主题
收起左侧

FB新鲜出炉二轮店面

🔗
Aprilyn 2015-4-20 15:21:42 | 只看该作者
本楼:
全局:
cong lz!!
回复

使用道具 举报

🔗
 楼主| shawlin 2015-4-21 02:35:32 | 只看该作者
全局:
yuxrose 发表于 2015-4-20 01:45
lz请问find leaf node with min depth是leetcode那道min depth的题吗?有什么不同吗?

这题要找到min depth 的leaf node, 不仅仅是depth
回复

使用道具 举报

🔗
yuxrose 2015-4-21 02:49:17 | 只看该作者
全局:
shawlin 发表于 2015-4-21 02:35
这题要找到min depth 的leaf node, 不仅仅是depth

soga, 谢谢lz!
回复

使用道具 举报

🔗
jianixie 2015-4-21 05:09:47 | 只看该作者
全局:
果断用BFS,  小哥让给出复杂度in terms of the min depth.

lz,这个答案是2^mindepth吗?

然后circular buff要考虑满了之后还不停往里加的情况吗?

谢谢!
回复

使用道具 举报

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

使用道具 举报

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

使用道具 举报

🔗
jianixie 2015-4-22 05:21:54 | 只看该作者
全局:
shawlin 发表于 2015-4-21 23:27
是的,就是一个等比数列求和。。。
circular buffer 我当时写的时候 如果加入新的element array 会超过b ...

谢谢lz,粘粘喜气~~
回复

使用道具 举报

🔗
mnmunknown 2015-4-22 05:32:12 | 只看该作者
全局:
Imielinski课坐你前面的前来手动点赞
回复

使用道具 举报

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

使用道具 举报

🔗
sheepmiemies 2015-4-23 10:54:48 | 只看该作者
全局:
大概C++写了个很naive版,水平有限可能有很多没考虑到的地方,请轻拍。。。
  1. class cyclicalBuffer {
  2. private:
  3.     int head;
  4.     int tail;
  5.     int count;
  6.     int size;
  7.     vector<int> buffer;
  8.    
  9. public:
  10.     cyclicalBuffer(int n) {
  11.         head = 0;
  12.         tail = 0;
  13.         count = 0;
  14.         size = n;
  15.         vector<int> buffer(n);
  16.     }
  17.     void push(int x) {
  18.         if (count == size) {
  19.             cout << "Failed! The buffer is full!" << endl;
  20.             return;
  21.         }
  22.         buffer[tail] = x;
  23.         tail = (tail + 1) % size;
  24.     }
  25.     int pop() {
  26.         if (count == 0) {
  27.             cout << "Failed! The buffer is empty!" << endl;
  28.             return -1;
  29.         }
  30.         
  31.         int temp = buffer[head];
  32.         head = (head + 1) % size;
  33.         return temp;
  34.     }
  35. }
复制代码

补充内容 (2015-4-29 06:19):
count忘了加减了,大家不要忘了~
回复

使用道具 举报

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

本版积分规则

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