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

Linkedin电面

🔗
匿名用户-FQJSN  2022-7-11 07:45:31 |倒序浏览

2022(4-6月) 码农类General 本科 全职@linkedin - 猎头 - 技术电面  | 😃 Positive 😐 Average | Other | 在职跳槽

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

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

x
本帖最后由 匿名 于 2022-7-10 16:53 编辑

猎头推的Sr. Backend,6月底电面,面试官是1个Asian女生和1个国人男生。
1. 只是试水很简单,implement a math power method
  1. // a = 2, b = 4, a^b = 16
  2. // a = 2, b = -4, a^b = 1/16
  3. public double pow(double a, int b) {
  4.     if(a == 0) return 0;
  5.     if(b == 0) return 1;
  6.     double res = 1;
  7.     for(int i = 0; i < Math.abs(b); i++)
  8.         res *= a;

  9.     if(b >= 0)
  10.         return res;
  11.     else
  12.         return 1 / res;
  13. }
复制代码
2. LL的经典题RetainBestCache,奉上solution,应该不能运行但面试官说okay。可以参照此贴
  1. // cache: [(cat, 3),(snake, 1), (spider, 10)]
  2. // cpacity = 3
  3. // rbc.get(snake)
  4. // db.get(snake) -> 1
  5. // return 1
  6. public class RetainBestCache<K, V extends Rankable> {
  7.     int cap;
  8.     HashMap<K, V> cache;
  9.     PriorityQueue<Entry<K, V>> pq;
  10.     DataSource<K, V> ds;

  11.   public RetainBestCache(DataSource<K, V> ds, int capacity) {
  12.     // implementation
  13.     cache = new HashMap<>();
  14.     pq = new PriorityQueue<>(new Comparator<Entry<K, V>>(){
  15.         @Override
  16.         public int compare(Entry<K, V> e1, Entry<K, V> e2) {
  17.             return e1.getRank() - e2.getRank();
  18.         }
  19.     });
  20.     this.ds = ds;
  21.     cap = capacity;
  22.   }

  23.     public V get(K key) {
  24.     // Implementation here
  25.         if(cache.containsKey(key))
  26.             return cache.get(key);
  27.         
  28.         V val = ds.get(key);
  29.         if(cache.size() < cap) {
  30.             cache.put(key, val);
  31.             pq.offer(new Entry(key, val));
  32.         } else {
  33.             Entry<K, V> top = pq.poll();
  34.             cache.remove(top.getKey());
  35.             
  36.             cache.put(key, val);
  37.             pq.offer(new Entry(key, val));
  38.         }
  39.         return val;
  40.     }
  41. }

  42. /*
  43. * For reference, here are the Rankable and DataSource interfaces.
  44. * You do not need to implement them, and should not make assumptions
  45. * about their implementations.
  46. */

  47. public interface Rankable {
  48.   /**
  49.    * Returns the Rank of this object, using some algorithm and potentially
  50.    * the internal state of the Rankable.
  51.    */
  52.   long getRank();
  53. }

  54. public interface DataSource<K, V extends Rankable> {
  55.   V get (K key);
  56. }
复制代码
整个面试整体感觉还不错,但没后续了,发邮件给
您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限查看其他获取积分的方式
Unlock interview details and practice with AI
Curated Interview Questions from Top Companies
res = power(x, n / 2);
        
        if(n % 2 == 0)
            return res * res;
        else
            return res * res * x;
    }
}

评分

参与人数 1大米 +10 收起 理由
匿名用户-RA7LO + 10

查看全部评分


上一篇:2023 Goldman Sachs OA
下一篇:Google 电面 挂
🔗
qjx026 2022-7-11 14:23:42 | 只看该作者
全局:
应该没问题,他们上周好像office close 一周,recruiter 不回邮件正常
回复

使用道具 举报

地里匿名用户
🔗
匿名用户-QA660  2022-7-12 01:44:56
他们好喜欢考cache
回复

使用道具 举报

🔗
xahbal1 2022-7-12 01:53:52 | 只看该作者
全局:

api query heavy
回复

使用道具 举报

🔗
xahbal1 2022-7-12 01:53:53 | 只看该作者
全局:

api query heavy
回复

使用道具 举报

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

本版积分规则

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