每日一练 | Data Scientist Business Analyst Leetcode 面试题 1200

发布于 2021-09-07 11:36 ,所属分类:2021面试经验技巧分享

点击上方蓝字 会变美




Aug.

30

Data Application Lab 自2017年6月15日起,每天和你分享讨论一道数据科学(DS)和商业分析(BA)领域常见的面试问题。

自2017年10月4日起,每天再为大家分享一道Leetcode 算法题。


希望积极寻求相关领域工作的你每天我们的问题并且与我们一起思考,我们将会在第二天给出答案。



Day

1100

DS Interview Question

What is the difference between stochastic gradient descent (SGD) and gradient descent (GD)?

BA Interview Question

Write a query in SQL to obtain the name of the physicians who are trained for a special treatment.


Sample table: physician

Employeeid | name | position | ssn
------------+------------------------------+-------------------------------------------+---------------------
1 | John Dorian | Staff Internist | 111111111
2 | Elliot Reid | Attending Physician | 222222222
3 | Christopher Turk | Surgical Attending Physician | 333333333
4 | Percival Cox | Senior Attending Physician | 444444444
5 | Bob Kelso | Head Chief of Medicine | 555555555
6 | Todd Quinlan | Surgical Attenian | 666666666
7 | John Wen | Surgical Attending Physician | 777777777
8 | Keith Dudemeister | MD Resident | 888888888
9 | Molly Clock | Attending Psychiatrist | 999999999



Sample table: procedure


code | name | cost
------+-------------------------------------------+-------------
1 | Reverse Rhinopodoplasty | 1500
2 | Obtuse Pyloric Recombobulation | 3750
3 | Folded Demiophtalmectomy | 4500
4 | Complete Walletectomy | 10000
5 | Obfuscated Dermogastrotomy | 4899
6 | Reversible Pancreomyoplasty | 5600
7 | Follicular Demiectomy | 25

LeetCode Question

Add Two Linked Lists


Description:

You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list.

You may assume the two numbers do not contain any leading zero, except the number 0 itself.

Day

1099

答案揭晓

DSInterview Question & Answer

While working on a data set, how do you select important variables? Explain your methods.

  • Remove the correlated variables prior to selecting important variables

  • Use linear regression and select variables based on p values

  • Use Forward Selection, Backward Selection, Stepwise Selection

  • Use Random Forest, Xgboost and plot variable importance chart

  • Measure information gain for the available set of features and select top n features accordingly.

BA Interview Question & Answer

Write a query in SQL to count the number of unavailable rooms

Sample table: room

roomnumber | roomtype | blockfloor | blockcode | unavailable
-----------+----------+------------+-----------+-------------
101 | Single | 1 | 1 | f
102 | Single | 1 | 1 | f
103 | Single | 1 | 1 | f
111 | Single | 1 | 2 | f
112 | Single | 1 | 2 | t
113 | Single | 1 | 2 | f
121 | Single | 1 | 3 | f
122 | Single | 1 | 3 | f
123 | Single | 1 | 3 | f
201 | Single | 2 | 1 |
202 | Single | 2 | 1 | f
203 | Single | 2 | 1 | f
211 | Single | 2 | 2 | f

212 | Single | 2 | 2 | f
213 | Single | 2 | 2 | t
221 | Single | 2 | 3 | f
222 | Single | 2 | 3 | f
223 | Single | 2 | 3 | f
301 | Single | 3 | 1 | f
302 | Single | 3 | 1 | t
303 | Single | 3 | 1 | f
311 | Single | 3 | 2 | f
312 | Single | 3 | 2 | f
313 | Single | 3 | 2 | f
321 | Single | 3 | 3 | t
322 | Single | 3 | 3 | f
323 | Single | 3 | 3 | f
401 | Single | 4 | 1 | f
402 | Single | 4 | 1 | t
403 | Single | 4 | 1 | f
411 | Single | 4 | 2 | f
412 | Single | 4 | 2 | f
413 | Single | 4 | 2 | f
421 | Single | 4 | 3 | t
422 | Single | 4 | 3 | f
423 | Single | 4 | 3 | f

Answer:

7

SELECT count(*) "Number of available rooms"
FROM room
WHERE unavailable='t'

LeetCode Question & Answer

Rotate List

Description:

Given a list, rotate the list to the right by k places, where k is non-negative.

Input: 1->2->3->4->5->NULL k=2

Output: 4->5->1->2->3->NULL

Tips:

注意所有corner case

Code:

时间复杂度:O(n)

空间复杂度:O(1)

往期精彩回顾


想快速学习数据科学?技巧经验都在这儿!

如何准备Front-End Back-End岗位面试?

2021年数据工程师,你最需要这10个技能!

详解netflix推荐系统

数据岗位大合集|DS、DA、BA和DE的区别及求职面试重点





点「在看」的人都变好看了哦

点击“”查看数据应用学院核心课

相关资源