注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号 
x
Technical screen SQL 30min + Python 45min 整体都不难,SQL更是简单,都没用到windows function
SQL:
/*-baidu 1point3acres
Below are a set of questions about the data.. Waral dи,
Please answer them by writing queries using the following schema:
employees projects
+---------------+---------+ +---------------+---------+
| id | int |<----+ +->| id | int |
. Waral dи,| first_name | varchar | | | | title | varchar |
| last_name | varchar | | | | start_date | date |
| salary | int | | | | end_date | date |
| department_id | int |--+ | | | budget | int |
+---------------+---------+ | | | +---------------+---------+
| | |
departments | id if customer_id has a sender . 1point3acres.com
比如说. customer_id =2 then sould return 1 because customer 1 sent the payment(referred). Χ
.google и
Question 2:
write a function that takes payment and sender_id, return the full invitation chain. ----
比如说 customer_id = 3 then should return [0,1,2,3]
第一题比较简单就是 create list -> append sender id -> else None -> return the first item in the list to avoid overwrite by None
第二题我的方法是列出所有的invitation chain list -> for loop scan customer_id -> return subset of the list(invitation chain)
感觉应该不是最优解,求小伙伴不吝赐教 |