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

硬币基地karat店面

🔗
匿名用户-UEMVE  2022-5-17 00:40:24 |倒序浏览

2022(4-6月) 码农类General 本科 全职@coinbase - 网上海投 - 技术电面  | 😐 Neutral 😐 Average | Pass | 在职跳槽

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

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

x
平台: Karat

面试官: 南非外包小哥
15 min - Desig
您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限 或 查看其他获取积分的方式
Unlock interview details and practice with AI
Popular Interview Questions from Top Companies
g的逻辑,没有特别的算法
  1. Write a function that takes the logs as input, builds the transition graph and returns it as an adjacency list with probabilities. Add __START__ and __END__ states.

  2. Specifically, for each resource, we want to compute a list of every possible next step taken by any user, together with the corresponding probabilities. The list of resources should include __START__ but not __END__, since by definition __END__ is a terminal state.

  3. Expected output for logs1:
  4. transition_graph(logs1) # =>
  5. {
  6.     '__START__': {'resource_1': 0.25, 'resource_2': 0.125, 'resource_3': 0.5, 'resource_6': 0.125},
  7.     'resource_1': {'resource_6': 0.333, '__END__': 0.667},
  8.     'resource_2': {'__END__': 1.0},
  9.     'resource_3': {'__END__': 0.4, 'resource_1': 0.2, 'resource_2': 0.2, 'resource_3': 0.2},
  10.     'resource_4': {'__END__': 1.0},
  11.     'resource_5': {'resource_4': 1.0},
  12.     'resource_6': {'__END__': 0.5, 'resource_5': 0.5}
  13. }


  14. For example, of 8 total users, 4 users have resource_3 as a first visit (user_1, user_2, user_3, user_5), 2 users have resource_1 as a first visit (user_6, user_22), 1 user has resource_2 as a first visit (user_7), and 1 user has resource_6 (user_8) so the possible next steps for __START__ are resource_3 with probability 4/8, resource_1 with probability 2/8, and resource_2 and resource_6 with probability 1/8.

  15. These are the resource paths per user for the first logs example, ordered by access time:
  16. {
  17.     'user_1': ['resource_3', 'resource_3', 'resource_1'], r
  18.     'user_2': ['resource_3', 'resource_2'],
  19.     'user_3': ['resource_3'],
  20.     'user_5': ['resource_3'],
  21.     'user_6': ['resource_1', 'resource_6', 'resource_5', 'resource_4'],
  22.     'user_7': ['resource_2'],
  23.     'user_8': ['resource_6'],
  24.     'user_22': ['resource_1'],
  25. }


  26. Expected output for logs2:
  27. transition_graph(logs2) # =>
  28. {
  29.   '__START__': {'resource_3': 1.0},
  30.   'resource_3': {'resource_3: 0.857, '__END__': 0.143}
  31. }

  32. Expected output for logs3:
  33. transition_graph(logs3) # =>
  34. {
  35.   '__START__': {'resource_5': 1.0},
  36.   'resource_5': {'__END__': 1.0}
  37. }

  38. Complexity analysis variables:

  39. n: number of logs in the input


  40. sample_input:
  41. logs = {
  42.      { "6500", "user_1", "resource_1"  },
  43.      { "4200", "user_2", "resource_2" },
  44.      { "7800", "user_22", "resource_1" },
  45.      { "980", "user_7", "resource_2" },
  46.      { "23", "user_6", "resource_1" },
  47.      { "6000", "user_1", "resource_3" },
  48.      { "345", "user_6", "resource_5" },
  49.      { "3200", "user_2", "resource_3" },
  50.      { "2", "user_1", "resource_3" },
  51.      { "201", "user_6", "resource_6" },
  52.      { "998", "user_8", "resource_6" },
  53.      { "5621", "user_3", "resource_3" },
  54.      { "10212", "user_6", "resource_4" },
  55.      { "29899", "user_5", "resource_3" }
  56. }

  57. sample_output of above input:
  58. __START__: [["resource_3": 0.5], ["resource_2": 0.125], ["resource_1": 0.25], ["resource_6": 0.125]]
  59. resource_1: [["__END__": 0.6666667], ["resource_6": 0.33333334]]
  60. resource_2: [["__END__": 1.0]]
  61. resource_3: [["__END__": 0.4], ["resource_3": 0.2], ["resource_2": 0.2], ["resource_1": 0.2]]
  62. resource_4: [["__END__": 1.0]]
  63. resource_5: [["resource_4": 1.0]]
  64. resource_6: [["__END__": 0.5], ["resource_5": 0.5]]
复制代码

评分

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

查看全部评分


上一篇:热带雨林欧诶
下一篇:刀大师昂赛过经
🔗
daviddage 2022-5-17 08:36:36 | 只看该作者
全局:
他们家到底是怎么决定是karat还是自己面 karat是不是就不是面经题了
回复

使用道具 举报

地里匿名用户
🔗
匿名用户-UEMVE  2022-5-18 02:06:46
1. 问了一下recruiter说是最近面试多,安排不过来
2. karat 每个公司好像有自己的题库
回复

使用道具 举报

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

本版积分规则

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