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

Linkedin Data Scientist Phone Interview

全局:

2018(7-9月) 分析|数据科学类 硕士 全职@linkedin - 网上海投 - 技术电面  | | Other | 在职跳槽

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

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

x
Problem Statement:  Member can make purchase via either mobile  or desktop platform. Using the following data table to determine the total number of member and revenue for mobile-only, desktop_only and
您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限查看其他获取积分的方式
Unlock interview details and practice with AI
Curated Interview Questions from Top Companies
案吧.... check 1point3acres for more.


. From 1point 3acres bbs

补充内容 (2018-7-12 12:37):
在code pad写了这么多R后。。面试官跟我说 她不会用R...能不能写一个SQL版本TAT 我于是直接一个剪切把R code都删了。现在想想 应该留着....给有缘人看@@

评分

参与人数 4大米 +38 收起 理由
wwx_27 + 2 给你点个赞!
匿名用户-LKBHE + 30 给你点个赞!
asyz13jinage + 5 很有用的信息!
tzuyiyen + 1 很有用的信息!

查看全部评分


上一篇:Facebook Data Scientist Analytics 电面
下一篇:Visa Data Scientist电面
推荐
miaozuoyu 2018-7-12 08:46:04 | 只看该作者
全局:
MySQL 答案. Χ
select date,chn,count(spend) as total_spend, count(distinct member_id)
from
(
select member_id,date,spend,
case when cnt=1 then channel. From 1point 3acres bbs
     else 'both' end as chn
from
(
select member_id,date, count(distinct channel) as cnt
from spending
group by member_id, date) as s1
inner join spending as s2. 1point 3acres
using(member_id,date)
) as t. From 1point 3acres bbs
group by date, chn
. 1point 3 acresorder by date

评分

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

查看全部评分

回复

使用道具 举报

推荐
chipmunkL 2018-7-12 23:43:33 | 只看该作者
全局:
SELECT s1.date AS date, .1point3acres
(CAESE WHEN COUNT(DISTINCT s2.channel) = 1 THEN s2.channel ELSE "both" END) AS channel,
(SUM(s2.spend)) AS total_spend, .1point3acres
(COUNT(distinct member_id) AS total_members
FROM Spending s1 LEFT JOIN Spending s2 ..
ON s1.member_id = s2.member_id AND s1.date = s2.date
GROUP BY date
ORDER BY date;

评分

参与人数 1大米 +10 收起 理由
匿名用户-LKBHE + 10 给你点个赞!

查看全部评分

回复

使用道具 举报

推荐
chipmunkL 2018-7-12 23:43:21 | 只看该作者
全局:
SELECT s1.date AS date,
(CAESE WHEN COUNT(DISTINCT s2.channel) = 1 THEN s2.channel ELSE "both" END) AS channel,
(SUM(s2.spend)) AS total_spend, . 1point3acres.com
(COUNT(distinct member_id) AS total_members
FROM Spending s1 LEFT JOIN Spending s2
ON s1.member_id = s2.member_id AND s1.date = s2.date. 1point3acres
GROUP BY date
ORDER BY date;

评分

参与人数 1大米 +10 收起 理由
匿名用户-LKBHE + 10 给你点个赞!

查看全部评分

回复

使用道具 举报

🔗
cixian1110 2018-7-12 07:46:13 | 只看该作者
全局:
问题有一处不清楚,假如一个member在第一天买了desktop第二天买了mobile,那么有两种可能
1.两天都算both
2.第一天是desktop第二天是Mobile。

后面一种稍微难写一点点, 下面是code。如果按第一种的话同样思路稍微改改就行。
. 1point3acres.com
with desktop_only as
(
        select cast(member_id as varchar) || cast(date as varchar)
        from spending
        group by member_id, date
        having sum(if(channel = 'mobile', 1, 0)) = 0
),
mobile_only as
(
        select cast(member_id as varchar) || cast(date as varchar)
        from spending
        group by member_id, date
        having sum(if(channel = 'desktop', 1, 0)) = 0
),
both as
(
        select cast(member_id as varchar) || cast(date as varchar). 1point3acres
        from spending.google  и
        group by member_id, date
        having sum(if(channel = 'mobile', 1, 0)) > 0 . ----
        and sum(if(channel = 'mobile', 1, 0)) > 0
)
select date, channel, sum(spend) as total_spend, count(distinct member_id) as total_members.--
from
(
        select *, .1point3acres
        case when cast(member_id as varchar) || cast(date as varchar) in (select * from desktop_only) then 'desktop'
                 when cast(member_id as varchar) || cast(date as varchar) in (select * from mobile_only) then 'mobile'
                 else 'both'
        end as channel
        from spending  
). .и
group by date, channel
order by date, channel
. ----


补充内容 (2018-7-12 07:47):
with里面没必要写both的subquery 多余了

评分

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

查看全部评分

回复

使用道具 举报

🔗
miaozuoyu 2018-7-12 08:49:34 | 只看该作者
全局:
L家DS秋招这么早?
回复

使用道具 举报

🔗
miaozuoyu 2018-7-12 09:13:03 | 只看该作者
全局:
抱歉第一行应该是sum(spend)
回复

使用道具 举报

🔗
 楼主| hyper8866 2018-7-12 12:11:20 | 只看该作者
全局:
miaozuoyu 发表于 2018-7-12 08:49
L家DS秋招这么早?

不知道呀 感觉SQL写起来是真麻烦...
回复

使用道具 举报

🔗
 楼主| hyper8866 2018-7-12 12:13:12 | 只看该作者
全局:
cixian1110 发表于 2018-7-12 07:46
问题有一处不清楚,假如一个member在第一天买了desktop第二天买了mobile,那么有两种可能
1.两天都算both
...

我觉得是第二种,我感觉核心就在于count=2是both...这要是我们公司数据库五行就出来了

哈哈替广大网友谢谢你的答案....
回复

使用道具 举报

🔗
getdreamoffer 2018-7-13 10:41:32 | 只看该作者
全局:
请问lz是自己申请的吗?L家有data scientist职位吗 只看到senior的。。
回复

使用道具 举报

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

本版积分规则

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