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

脸熟VO挂经

🔗
匿名用户-CXT3O  2020-5-15 02:17:11 |倒序浏览

2020(4-6月) 码农类General 硕士 全职@meta - 猎头 - 视频面试  | | Fail | 在职跳槽

注册一亩三分地论坛,查看更多干货!

您需要 登录 才可以下载或查看附件。没有帐号?注册账号

x
5轮:
1. 刷题网 五柳零, 六二幺;
2. 纯BQ,项目的挑战,与同事意见不同怎么办,manager意见不同,如何处
您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限 或 查看其他获取积分的方式
Unlock interview details and practice with AI
Popular Interview Questions from Top Companies
这个没写好,一直都是按inorder准备的。

两天后卒。

评分

参与人数 5大米 +15 收起 理由
michaellm + 1 很有用的信息!
匿名用户-YZNJZ + 8
oumizx + 3 很有用的信息!
StupidCorn + 1 给你点个赞!
funmastermike + 2 很有用的信息!

查看全部评分


上一篇:🍎 siri组HM screen电面
下一篇:蓬勃店面挂经

本帖被以下淘专辑推荐:

  • · 刷题|主题: 55, 订阅: 17
推荐
oumizx 2020-5-17 20:05:17 | 只看该作者
全局:

评分

参与人数 1大米 +1 收起 理由
huaye + 1 给你点个赞!

查看全部评分

回复

使用道具 举报

全局:
zzgzzm 发表于 2020-5-15 23:36
幺七三请问怎么叫要求preorder?那么这个典型的用stack存nodes是算pre-order吗?或者我没有明白怎么in-orde ...

前序和中序就是一套代码,只不过放栈时访问还是出栈时访问。
回复

使用道具 举报

推荐
zzgzzm 2020-5-16 03:10:03 | 只看该作者
全局:
Insert a node to a sorted circular list.
  1.     Node* insert(Node* head, int insertVal) {
  2.       if (!head) {
  3.         // create a single node circular list
  4.         Node* inserted_node = new Node(insertVal);
  5.         inserted_node->next = inserted_node;
  6.         return inserted_node;
  7.       }
  8.       
  9.       Node* cur = head;
  10.       
  11.       // loop list to find insertion position: cur->next
  12.       for (; cur->next != head; cur = cur->next) {
  13.         int curVal = cur->val;
  14.         int nextVal = cur->next->val;
  15.         
  16.         // curVal is max (nextVal is min), and insertVal is outside (min, max)
  17.         if (curVal > nextVal && (insertVal >= curVal || insertVal <= nextVal)) break;
  18.         
  19.         // insertVal is inside [curVal, nextVal]
  20.         if (curVal <= insertVal && insertVal <= nextVal) break;
  21.       }
  22.       
  23.       // insert a new node
  24.       Node* inserted_node = new Node(insertVal, cur->next);
  25.       cur->next = inserted_node;
  26.       
  27.       return head;
  28.     }
复制代码
回复

使用道具 举报

🔗
oumizx 2020-5-15 06:06:00 | 只看该作者
全局:
3的第二问是麒麟爸吧。 还有想问下lz 5里面用preorder写的思路是什么?
回复

使用道具 举报

地里匿名用户
🔗
匿名用户-CXT3O  2020-5-15 06:22:28
oumizx 发表于 2020-5-15 06:06
3的第二问是麒麟爸吧。 还有想问下lz 5里面用preorder写的思路是什么?

对,是这个,preorder这个我现场没搞出来
回复

使用道具 举报

🔗
funmastermike 2020-5-15 06:57:49 | 只看该作者
全局:
感觉散零药出来我也卒了肯定 那题好难啊
回复

使用道具 举报

地里匿名用户
🔗
匿名用户-CXT3O  2020-5-15 07:13:30
wengjn 发表于 2020-5-15 06:57
感觉散零药出来我也卒了肯定 那题好难啊

简化的,不是原题那个要求,仅仅去除无效的后得到一个有效解即可
回复

使用道具 举报

🔗
wsrrzxl 2020-5-15 09:39:24 | 只看该作者
全局:
游客 73.19.61.x 发表于 2020-5-15 07:13
简化的,不是原题那个要求,仅仅去除无效的后得到一个有效解即可

是1249吧
回复

使用道具 举报

地里匿名用户
🔗
匿名用户-CXT3O  2020-5-15 11:16:42
您好!
本帖隐藏的内容需要积分高于 100 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 100 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限 或 查看其他获取积分的方式
Unlock interview details and practice with AI
Popular Interview Questions from Top Companies
回复

使用道具 举报

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

使用道具 举报

🔗
amaze 2020-5-15 16:07:36 | 只看该作者
全局:
楼主 有拿到面试feedback么,说是那一轮没面好?
回复

使用道具 举报

🔗
zzgzzm 2020-5-15 23:36:28 | 只看该作者
全局:
幺七三请问怎么叫要求preorder?那么这个典型的用stack存nodes是算pre-order吗?或者我没有明白怎么in-order解决?只见过一个用Morris traverse称in-order,但我觉得这in-order很不方便....

  1. class BSTIterator {

  2. private:
  3.     stack<TreeNode*> _s;

  4.     void pushLeft(TreeNode* x) {
  5.         while (x) _s.push(x), x = x->left;
  6.     }

  7. public:
  8.     BSTIterator(TreeNode *root) {
  9.         pushLeft(root);
  10.     }

  11.     /** [url=home.php?mod=space&uid=160137]@return[/url] whether we have a next smallest number */
  12.     bool hasNext() {
  13.         return !_s.empty();
  14.     }

  15.     /** @return the next smallest number */
  16.     int next() {
  17.         auto x = _s.top(); _s.pop();
  18.         pushLeft(x->right);
  19.         return x->val;
  20.     }
  21. };
复制代码
回复

使用道具 举报

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

本版积分规则

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