每日一练 | Data Scientist amp; Business Analyst amp; Leetcode 面试题 1410

MBTI职业性格测试 0 14

点击上方 蓝字 会变美

每日一练 | Data Scientist amp; Business Analyst amp; Leetcode 面试题 1410

Jun.

20

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

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

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

Day

1310

DS Interview Question

Can the lambda forms in Python contain statements?

BA Interview Question

Department Highest Salary

The Employee table holds all employees. Every employee has an Id, a salary, and there is also a column for the department Id.

| Id | Name | Salary | DepartmentId |

| 1 | Joe | 70000 | 1 |

| 2 | Henry | 80000 | 2 |

| 3 | Sam | 60000 | 2 |

| 4 | Max | 90000 | 1 |

The Department table holds all departments of the company.

| Id | Name |

| 1 | IT |

| 2 | Sales |

Write a SQL query to find employees who have the highest salary in each of the departments. For the above tables, Max has the highest salary in the IT department and Henry has the highest salary in the Sales department.

| Department | Employee | Salary |

| IT | Max | 90000 |

| Sales | Henry | 80000 |

LeetCode Question

Rotate Array

每日一练 | Data Scientist amp; Business Analyst amp; Leetcode 面试题 1410

Deion:

Rotate an array of n elements to the right by k steps.

For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4]. Could you do it in-place with O(1) extra space?

Input: [1,2,3,4,5,6,7] 3

每日一练 | Data Scientist amp; Business Analyst amp; Leetcode 面试题 1410

Output: [5,6,7,1,2,3,4]

Day

1309

答案揭晓

DS Interview Question Answer

What’s the loss function log-loss?

Log Loss is an evaluation metric used in (multinomial) logistic regression and extensions of it such as neural networks, defined as the negative log-likelihood of the true labels given a probabilistic classifier’s predictions.

BA Interview Question Answer

Customers Who Never Order

Suppose that a website contains two tables, the Customers table and the Orders table. Write a SQL query to find all customers who never order anything.

Table: Customers.

| Id | Name |

| 1 | Joe |

| 2 | Henry |

| 3 | Sam |

| 4 | Max |

Table: Orders.

| Id | CustomerId |

| 1 | 3 |

| 2 | 1 |

Using the above tables as example, return the following:

| Customers |

| Henry |

| Max |

Answer:

select customers.name as 'Customers'

from customers

where customers.id not in

(select customerid from orders

Reference:

/

LeetCode Question Answer

Combine Two Tables

Deion:

Write a SQL query for a report that provides the following information for each person in the Person table, regardless if there is an address for each of those people:

FirstName, LastName, City, State

Input:

Table: Person

| Column Name | Type |

| PersonId | int |

| FirstName | varchar |

| LastName | varchar |

PersonId is the primary key column for this table.

Table: Address

| Column Name | Type |

| AddressId | int |

| PersonId | int |

| City | varchar |

| State | varchar |

AddressId is the primary key column for this table.

Solution:因为每个人不管地址存不存在都要在新表中,所以用person表左外连接address表

Code:

SELECT a.FirstName, a.LastName, b.City, b.State

FROM Person a

LEFT OUTER JOIN Address b

on a.PersonId = b.PersonId;

Excel小能手们,如何让自己数据分析及汇报的能力再上一层楼?

数据人必知的5个异常值检测小技巧,你用过哪个?

Coinbase裁员18%,Redfin裁员8%,Bird裁员23%……北美就业市场寒冬来了吗?

深度学习——一个努力勤奋学习理解人类的智能系统

Python3.11新鲜出炉,快来看看有哪些亮点!

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

相关推荐:

网友留言:

我要评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。