专栏名称: 大数据应用
数据应用学院被评为2016北美Top Data Camp, 是最专业一站式数据科学咨询服务机构,你的数据科学求职咨询专家!
目录
相关文章推荐
软件定义世界(SDX)  ·  清华出品!104页DeepSeek从入门到精 ... ·  4 天前  
数据派THU  ·  Transfusion: ... ·  4 天前  
数据派THU  ·  【ICLR2025】扩散图网络:使用扩散图网 ... ·  5 天前  
大数据D1net  ·  2025年数据治理趋势与成功策略全解析 ·  3 天前  
大数据分析和人工智能  ·  这样做,DeepSeek输出增强100倍 ·  3 天前  
51好读  ›  专栏  ›  大数据应用

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

大数据应用  · 公众号  · 大数据  · 2019-10-17 08:46

正文


点击上方 蓝字 会变美




Oct.

16

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

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


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

Day

621

DS Interview Question

Describe what is a decision tree algorithm.

BA Interview Question

Second Highest Salary


Write a SQL query to get the second highest salary from the Employee table.
+----+--------+
| Id | Salary |
+----+--------+
| 1  | 100    |ta
| 2  | 200    |
| 3  | 300    |
+----+--------+


For example, given the above Employee table, the query should return 200 as the second highest salary. If there is no second highest salary, then the query should return null.

+---------------------+
| SecondHighestSalary |
+---------------------+
| 200                 |
+---------------------+

LeetCode Question

N Queen


Description:

The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other.

Input: 4

Output: [[".Q…", // Solution 1 “…Q”, “Q…”, “…Q.”], ["…Q.", // Solution 2 “Q…”, “…Q”, “.Q…”]]

Day

620

答案揭晓

DS Interview Question & Answer

Give me some examples about the applications of Naive Bayes Algorithms.

Real time Prediction: Naive Bayes is an eager learning classifier and it is sure fast. Thus, it could be used for making predictions in real time.

Multi class Prediction: This algorithm is also well known for multi class prediction feature. Here we can predict the probability of multiple classes of target variable.

Text classification/ Spam Filtering/ Sentiment Analysis: Naive Bayes classifiers mostly used in text classification (due to better result in multi class problems and independence rule) have higher success rate as compared to other algorithms. As a result, it is widely used in Spam filtering (identify spam e-mail) and Sentiment Analysis (in social media analysis, to identify positive and negative customer sentiments)

Recommendation System: Naive Bayes Classifier and Collaborative Filtering together builds a Recommendation System that uses machine learning and data mining techniques to filter unseen information and predict whether a user would like a given resource or not

BA Interview Question & Answer

Combine two tables


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.

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


Answers: Using outer join. Since the PersonID in table Address is the foreign key of a table Person, we can join this two table to get the address information of a person. Considering there might not be an address information for every person, we should use outer join instead of the default inner join.


MySQL:

select p.FirstName, p.LastName, a.City, a.State

from p.Person

left join a.Address

on p.PersonId = a.PersonId;


Reference:

https://leetcode.com/problems/combine-two-tables/description/







请到「今天看啥」查看全文