每日一练 | Data Scientist & Business Analyst & Leetcode 面试题 320
自2017年6月15日起,数据应用学院与你一起温习数据科学(DS)和商业分析(BA)领域常见的面试问题。从2017年10月4号起,每天再为大家分享一道Leetcode算法题。
希望积极寻求相关领域工作的你每天关注我们的问题并且与我们一起思考,我们将会在第二天给出答案。
Day 220
DS Interview Questions
What are feature vectors?
BA Interview Questions
SQL: Query the Name of any student in STUDENTS who scored higher than Marks. Order your output by the last three characters of each name. If two or more students both have names ending in the same last three characters (i.e.: Bobby, Robby, etc.), secondary sort them by ascending ID.
The STUDENTS table is described as follows:
The Name column only contains uppercase (A-Z) and lowercase (a-z) letters.
Sample Input:
Sample Output:
Ashley
Julia
Belvet
LeetCode Questions
Description:
Given two integers n and k, return all possible combinations of k numbers out of 1 … n.
Input: n = 4 and k = 2
Output: [[2,4],[3,4],[2,3],[1,2],[1,3],[1,4],]
欲知答案如何?请见下期分解!
Day 219 答案揭晓
DS Interview Questions
What’s the “kernel trick” and how is it useful?
Kernel trick:
Kernel functions can enable in higher-dimension spaces without explicitly calculating the coordinates of points within that dimension: instead, kernel functions compute the inner products between the images of all pairs of data in a feature space.
Why it is useful:
It can calculate the coordinates of higher dimensions while being computationally cheaper than the explicit calculation of said coordinates. Many algorithms can be expressed in terms of inner products. Using the kernel trick enables us effectively run algorithms in a high-dimensional space with lower-dimensional data.
BA Interview Questions
SQL: Write a query that prints a list of employee names (i.e.: the name attribute) for employees in Employee having a salary greater than per month who have been employees for less than months. Sort your result by ascending employee_id.
The Employee table containing employee data for a company is described as follows:
where employee_id is an employee's ID number, name is their name, months is the total number of months they've been working for the company, and salary is the their monthly salary.
Sample Input:
Sample Output:
Angela
Michael
Todd
Joe
Answer:
select name
from Employee
where months < 10 and salary > 2000
order by employee_id;
LeetCode Questions
Description:
Given a set of distinct integers, nums, return all possible subsets.
Input: [1,2,3]
Output: [[],[1],[1,2],[1,2,3],[1,3],[2],[2,3],[3]]
Assumptions:
The solution set must not contain duplicate subsets.
Solution:
子集问题就是隐式图的深度优先搜索遍历。因为是distinct,所以不需要去重
Code:
Time Complexity: O(2 ^ n)
Space Complexity: O(n)
点击“阅读原文”查看数据应用学院核心课程