回复: 19
收起左侧

Facebook ds 电面

本楼:   👍  0
0%
0%
0   👎
全局:   42
100%
0%
0

2019(1-3月) 分析|数据科学类 硕士 全职@facebook - 内推 - 技术电面  | | Other | 在职跳槽

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

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

x
  面试官迟到10分钟, 题目是高频面经,但是改了一些,这次只给了这一个table! 看来facebook 现在也会把已有的题目变一下?还是面试官自己决定的? 她后来补充只要post被report as spam once,那么那个post就被看作spam。  求大米!!!

  Table:user_actions
    ds (STRING) |user_id (BIGINT) |post_id (BIGINT) |action (STRING) | extra (STRING)
    '2018-07-01'|1209283021       | 329482048384792 |'view'         |
    '2018-07-01'|1209283021       | 329482048384792 |'like'         |
您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限查看其他获取积分的方式
="left">group by post_id )
select coalesce(sum( case when b.num_spam > 0 then 1 else0 end )/count(a.post_id),0)
from a
left join b
on a.post_id = b.post_id

中间卡壳了。。。 也不知道我写的对不对???
求大米!!!求大米!!!

评分

参与人数 10大米 +42 收起 理由
Sirius_Xue + 2 很有用的信息!
清道神君 + 20
zhangEpiphany + 1 赞一个
huixingzhijia + 3 谢谢分享!
wanli + 3 赞一个,写的这么详细

查看全部评分


上一篇:zillow applied scientist 电面 + 求 onsite 面经
下一篇:Deloitte (Senior) Consultant Analytics 电面
bwy071 2018-12-17 12:55:55 | 显示全部楼层
本楼:   👍  3
100%
0%
0   👎
全局:   29
97%
3%
1
Q2:
SELECT COUNT(b.post_id)/COUNT(a.post_id) AS spam_percent
FROM (SELECT DISTINCT post_id FROM User_actions WHERE ds=subdate(curdate(),1) AND action='view') a
LEFT JOIN -baidu 1point3acres
(SELECT DISTINCT post_id FROM User_actions WHERE ds=subdate(curdate(),1) AND extra='spam') b
. .иON a.post_id=b.post_id
如果不对,还请大家指正哈

回复

使用道具 举报

dedege 2018-12-15 08:33:03 | 显示全部楼层
本楼:   👍  1
100%
0%
0   👎
全局:   48
96%
4%
2
第一个sql没问题
. 1point3acres
如果让我回答第二个问题,我会写成这样:
with a as
(
        select user_id, post_id
        from user_actions.1point3acres
        where action = 'view'
),
b as
(. 1point 3 acres
        select distinct post_id
        from user_actions-baidu 1point3acres
        where action = 'report' and extra = 'SPAM'
)
select        100*sum(case when b.post_id is not null then 1 else 0 end)/count(*) "spam percent". 1point3acres
from        a left join b using(post_id)
回复

使用道具 举报

rainatalie 2018-12-15 05:33:20 | 显示全部楼层
本楼:   👍  0
0%
0%
0   👎
全局:   8
100%
0%
0
喵呜 求问楼主。。。。只用SQL 就可以了吗
回复

使用道具 举报

 楼主| earendil 2018-12-15 06:41:16 | 显示全部楼层
本楼:   👍  0
0%
0%
0   👎
全局:   42
100%
0%
0
rainatalie 发表于 2018-12-15 05:33
喵呜 求问楼主。。。。只用SQL 就可以了吗

是的, 你也可以选用python 或者 r 面
回复

使用道具 举报

dedege 2018-12-15 08:02:11 | 显示全部楼层
本楼:   👍  0
0%
0%
0   👎
全局:   48
96%
4%
2
earendil 发表于 2018-12-15 06:41-baidu 1point3acres
是的, 你也可以选用python 或者 r 面
.google  и
咋我遇到的都是先用sql,再用python?~
回复

使用道具 举报

dedege 2018-12-15 08:23:08 | 显示全部楼层
本楼:   👍  0
0%
0%
0   👎
全局:   48
96%
4%
2
b as ( select  post_id,count(count(distinct user_id) num_spam. 1point3acres.com
.1point3acres
补充内容 (2018-12-15 08:23):
上面这个为什么有两个count?
回复

使用道具 举报

unitary315 2018-12-15 12:37:30 | 显示全部楼层
本楼:   👍  0
0%
0%
0   👎
全局:   160
93%
7%
12
which team/role please? analytics?
回复

使用道具 举报

yshangcc 2018-12-16 05:22:49 | 显示全部楼层
本楼:   👍  0
0%
0%
0   👎
全局:   4
80%
20%
1
Q1: select extra, count(distinct post_id) from user_acitons where action = 'report' and ds = '<DATEID-1>' group by extra
回复

使用道具 举报

yshangcc 2018-12-16 05:28:09 | 显示全部楼层
本楼:   👍  0
0%
0%
0   👎
全局:   4
80%
20%
1
Q2: with a as (select post_id from user_actions where action = 'view' and ds = '<DATEID-1>') select 100.00*count_if(action = 'report' and extra = 'spam') /count(1) as pct_contentreport from user_actions where post_id in (select post_id from a)
回复

使用道具 举报

rainatalie 2018-12-16 10:50:43 | 显示全部楼层
本楼:   👍  0
0%
0%
0   👎
全局:   8
100%
0%
0
earendil 发表于 2018-12-15 06:41. Waral dи,
是的, 你也可以选用python 或者 r 面

谢谢楼主~~~!!
回复

使用道具 举报

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

本版积分规则

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