📣 黑五网一特惠|VIP一年通行证5折,蓝莓、Offer多多同步特惠
回复: 11
跳转到指定楼层
上一主题 下一主题
收起左侧

领英电面新鲜挂经

全局:

2021(7-9月) 码农类General 硕士 全职@linkedin - 内推 - 技术电面  | 🙁 Negative 😣 Hard | Fail | 在职跳槽

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

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

x
本场安排成了背靠背的第二场电面。上一场面完没两分钟就进了这场的meeting。
并不是很typical的刷题电面,上来先问了一些fundamental:


感觉我这波就是用一次interview,换了一次回馈地里的发帖机会……

评分

参与人数 7大米 +21 收起 理由
agenhcx + 2 很有用的信息!
cin13 + 3 欢迎分享你知道的情况,会给更多积分奖励!
匿名用户-QINPS + 8
Andyyan + 3 很有用的信息!
lll123123zzz + 1 给你点个赞!

查看全部评分


上一篇:Wish新鲜电面面经
下一篇:Quora OA 面经
推荐
ee19920302 2021-8-18 21:39:28 | 只看该作者
全局:
coding 应该是利口 依依叭叭

评分

参与人数 2大米 +4 收起 理由
agenhcx + 2 很有用的信息!
ellin + 2 很有用的信息!

查看全部评分

回复

使用道具 举报

推荐
sfmnrmnv 2021-8-18 13:55:04 | 只看该作者
全局:
这几个不符合北美面试风格,但确实是很基本的概念。。
回复

使用道具 举报

推荐
Falldawn 2021-8-29 08:07:17 | 只看该作者
全局:
在网上看了一下,照猫画虎写了一个,不知道对不对

  1. public class ThreadExample {
  2.     public static class PC {
  3.         private Queue<Integer> dataQueue;
  4.         private int cap;

  5.         public void init(int cap) {
  6.             this.cap = cap;
  7.             dataQueue = new ArrayDeque<>();
  8.         }

  9.         // Function called by producer thread
  10.         public void put (int data) throws InterruptedException {
  11.             while(true) {
  12.                 synchronized (this) {
  13.                     // producer thread waits while list is full
  14.                     while (dataQueue.size() == cap) {
  15.                         wait();
  16.                     }
  17.                     // to insert the jobs in the list
  18.                     dataQueue.offer(data);
  19.                     System.out.println("Put new data: " + data);

  20.                     // notifies the consumer thread that now it can start consuming
  21.                     notify();

  22.                     // makes the working of program easier to  understand
  23.                     Thread.sleep(1000);
  24.                 }
  25.             }
  26.         }

  27.         public void put (List<Integer> dataList) throws InterruptedException{
  28.             while(true) {
  29.                 synchronized (this) {
  30.                     // producer thread waits while list is full
  31.                     while (dataQueue.size() == cap) {
  32.                         wait();
  33.                     }

  34.                     // to insert the jobs in the list
  35.                     int i = 0;
  36.                     while (dataQueue.size() < cap && i < dataList.size()) {
  37.                         put(dataList.get(i));
  38.                         i++;
  39.                     }

  40.                     // notifies the consumer thread that now it can start consuming
  41.                     notify();

  42.                     // makes the working of program easier to  understand
  43.                     Thread.sleep(1000);
  44.                 }
  45.             }
  46.         }

  47.         // Function called by consumer thread
  48.         public int get() throws InterruptedException{
  49.             while (true) {
  50.                 synchronized (this) {
  51.                     // consumer thread waits while list is empty
  52.                     while (dataQueue.size() == 0) {
  53.                         wait();
  54.                     }

  55.                     // to retrieve the first job in the list
  56.                     int val = dataQueue.poll();

  57.                     // Wake up producer thread
  58.                     notify();

  59.                     // and sleep
  60.                     Thread.sleep(1000);
  61.                     return val;
  62.                 }
  63.             }
  64.         }
  65.     }
  66. }
复制代码
回复

使用道具 举报

全局:
本帖最后由 biomedicineman 于 2021-8-17 23:14 编辑

implementing a thread safe

所以是要求写concurrency code么?比如Java synchronized 或者Semaphore啥的?---
lz你面的啥岗位,怎么电面搞这么难的题。。。
回复

使用道具 举报

🔗
 楼主| ghostdd 2021-8-19 08:25:49 | 只看该作者
全局:
ee19920302 发表于 2021-8-18 06:39
coding 应该是利口 依依叭叭

感谢~原来是原题!
看来基本功不行还不刷题确实没有出路啊
回复

使用道具 举报

🔗
 楼主| ghostdd 2021-8-19 08:27:14 | 只看该作者
全局:
sfmnrmnv 发表于 2021-8-17 22:55
这几个不符合北美面试风格,但确实是很基本的概念。。

的确 尤其是楼主这种**一到这种时刻就露馅了= =!
看来基础知识不能落下呀
回复

使用道具 举报

🔗
zetman12345 2021-8-26 23:59:27 | 只看该作者
全局:
不好意思,楼主,我可以问一下是哪个组的吗?
回复

使用道具 举报

全局:
感谢楼主,看来我们是同一个面试官
回复

使用道具 举报

🔗
 楼主| ghostdd 2021-9-2 09:13:35 | 只看该作者
全局:
skinnylove 发表于 2021-9-1 15:19
感谢楼主,看来我们是同一个面试官

那不错呀希望有帮到你~ 面试官是WW吗?面得如何
回复

使用道具 举报

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

本版积分规则

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