谷歌、微软、facebook等科技巨头数据科学岗位面试题(108道)
微信后台回复:“区块链”,获取区块链报告
微信后台回复:“sq”,进入资料分享社群
热门推荐:
A fresh scrape from Glassdoor gives us a good idea about what applicants are asked during a data scientist interview at some of the top companies. Unfortunately for us, almost every company has their interviewees sign NDAs. Since Glassdoor allows anonymity, a few brave souls have given us some fantastic examples of what they were asked during the interview process at top companies like Facebook, Google, and Microsoft.
来自 Glassdoor 的最新数据可以告诉我们各大科技公司最近在招聘面试时最喜欢向候选人提什么问题。首先有一个令人惋惜的结论:根据统计,几乎所有的公司都有着自己的不同风格。由于 Glassdoor 允许匿名提交内容,很多乐于分享的应聘者向大家提供了 Facebook、谷歌、微软等大公司的面试题。
General Questions
Apple
Suppose you’re given millions of users that each have hundreds of transactions and these millions of transactions are for tens of thousands of products. How would you group the users together in meaningful segments?
如果你有几百万用户,每个用户都会发生数百笔交易,这些交易存在于数十种产品中。你该如何把这些用户细分成有意义的几类?
Microsoft
Describe a project you’ve worked on and how it made a difference.
描述一个你曾经参与的项目,以及它的优点。
How would you approach a categorical feature with high-cardinality?
如何处理具有高基数(high-cardinality)的类属特征?
What would you do to summarize a Twitter feed?
如果想要给 Twitter feed 写 summarize,你要怎么办?
What are the steps for wrangling and cleaning data before applying machine learning algorithms?
在应用机器学习算法之前纠正和清理数据的步骤是什么?
How do you measure distance between data points?
如何测量数据点之间的距离?
Define variance.
请定义一下方差。
Describe the differences between and use cases for box plots and histograms.
请描述箱形图(box plot)和直方图(histogram)之间的差异,以及它们的用例。
What features would you use to build a recommendation algorithm for users?
你会使用什么功能来为用户构建推荐算法?
Uber
Pick any product or app that you really like and describe how you would improve it.
选择任何一个你真正喜欢的产品或应用程序,并描述如何改善它。
How would you find an anomaly in a distribution ?
如何在分布中发现异常?
How would you go about investigating if a certain trend in a distribution is due to an anomaly?
如何检查分布中的某个趋势是否是由于异常产生的?
How would you estimate the impact Uber has on traffic and driving conditions?
如何估算 Uber 对交通和驾驶环境造成的影响?
What metrics would you consider using to track if Uber’s paid advertising strategy to acquire new customers actually works? How would you then approach figuring out an ideal customer acquisition cost?
你会考虑用什么指标来跟踪 Uber 付费广告策略在吸引新用户上是否有效?然后,你想用什么办法估算出理想的客户购置成本?
Big Data Engineer Can you explain what REST is?
(大数据工程师)请解释 REST 是什么。
Machine Learning Questions
Why do you use feature selection?
为什么要使用特征选择(feature selection)?
What is the effect on the coefficients of logistic regression if two predictors are highly correlated? What are the confidence intervals of the coefficients?
如果两个预测变量高度相关,它们对逻辑回归系数的影响是什么?系数的置信区间是什么?
What’s the difference between Gaussian Mixture Model and K-Means?
高斯混合模型(Gaussian Mixture Model)和 K-Means 之间有什么区别?
How do you pick k for K-Means?
在 K-Means 中如何拾取 k?
How do you know when Gaussian Mixture Model is applicable?
你如何知道高斯混合模型是不是适用的?
Assuming a clustering model’s labels are known, how do you evaluate the performance of the model?
假设聚类模型的标签是已知的,你如何评估模型的性能?
Microsoft
What’s an example of a machine learning project you’re proud of?
你有哪些引以为豪的机器学习项目?
Choose any machine learning algorithm and describe it.
随意选择一个机器学习算法,并描述它。
Describe how Gradient Boosting works.
请解释 Gradient Boosting 是如何工作的。
Data Mining Describe the decision tree model.
(数据挖掘工程师)请解释决策树模型。
Data Mining What is a neural network?
(数据挖掘工程师)什么是神经网络?
Explain the Bias-Variance Tradeoff
请解释偏差方差权衡(Bias-Variance Tradeoff)。
How do you deal with unbalanced binary classification?
如何处理不平衡二进制分类?
What’s the difference between L1 and L2 regularization?
L1 和 L2 正则化之间有什么区别?
Uber
What sort features could you give an Uber driver to predict if they will accept a ride request or not? What supervised learning algorithm would you use to solve the problem and how would compare the results of the algorithm?
你会通过哪种特征来预测 Uber 司机是否会接受订单请求?你会使用哪种监督学习算法来解决这个问题,如何比较算法的结果?
Name and describe three different kernel functions and in what situation you would use each.
点出及描述三种不同的内核函数,在哪些情况下使用哪种?
Describe a method used in machine learning.
随意解释机器学习里的一种方法。
How do you deal with sparse data?
如何应付稀疏数据?
IBM
How do you prevent overfitting?
如何防止过拟合(overfitting)?
How do you deal with outliers in your data?
如何处理数据中的离群值?
How do you analyze the performance of the predictions generated by regression models versus classification models?
如何评估逻辑回归与简单线性回归模型预测的性能?
How do you assess logistic regression versus simple linear regression models?
如何确定逻辑回归与简单线性回归模型?
What’s the difference between supervised learning and unsupervised learning?
监督学习和无监督学习有什么区别?
What is cross-validation and why would you use it?
什么是交叉验证(cross-validation),为什么要使用它?
What’s the name of the matrix used to evaluate predictive models?
用于评估预测模型的矩阵的称为什么?
What relationships exist between a logistic regression’s coefficient and the Odds Ratio?
逻辑回归系数和胜算比(Odds Ratio)之间存在怎样的关联?
What’s the relationship between Principal Component Analysis (PCA) and Linear & Quadratic Discriminant Analysis (LDA & QDA)
主成分分析(PCA)与线性判别分析(LDA)、二次判别分析(QDA)之间存在怎样的关联?
If you had a categorical dependent variable and a mixture of categorical and continuous independent variables, what algorithms, methods, or tools would you use for analysis?
如果你有一个因变量分类,又有一个连续自变量的混合分类,你将使用什么算法,方法或工具进行分析?
Business Analytics What’s the difference between logistic and linear regression? How do you avoid local minima?
(行业分析师)逻辑与线性回归有什么区别?如何避免局部极小值?
Salesforce
What data and models would would you use to measure attrition/churn? How would you measure the performance of your models?
你会使用哪些数据和模型来测量损耗/流失?如何测试模型性能?
Explain a machine learning algorithm as if you’re talking to a non-technical person.
请尝试向非技术人员解释一种机器学习算法。
Capital One
How would you build a model to predict credit card fraud?
如何构建一个模型来预测信用卡诈骗?
How do you handle missing or bad data?
如何处理丢失或不良数据?
How would you derive new features from features that already exist?
如何从已存在的特征中导出新的特征?
If you’re attempting to predict a customer’s gender, and you only have 100 data points, what problems could arise?
如果你试图预测客户的性别,但只有 100 个数据点,可能会出现什么问题?
Suppose you were given two years of transaction history. What features would you use to predict credit risk?
在拥有两年交易历史的情况下,哪些特征可以用来预测信用风险?
Design an AI program for Tic-tac-toe
设计一个用来下井字棋的人工智能程序。
Zillow
Explain overfitting and what steps you can take to prevent it.
请解释过度拟合,以及如何防止过度拟合。
Why does SVM need to maximize the margin between support vectors?
为什么 SVM 需要在支持向量之间最大化边缘?
Hadoop
How would you use Map/Reduce to split a very large graph into smaller pieces and parallelize the computation of edges according to the fast/dynamic change of data?
如何使用 Map/Reduce 将非常大的图形分割成更小的块,并根据数据的快速/动态变化并行计算它们的边缘?
Data Engineer Given a list of followers in the format:123, 345234, 678345, 123…Where column one is the ID of the follower and column two is the ID of the followee. Find all mutual following pairs (the pair 123, 345 in the example above). How would you use Map/Reduce to solve the problem when the list does not fit in memory?
(数据工程师)给定一个列表:123, 345234, 678345, 123…其中第一列是粉丝的 ID,第二列是被粉者的 ID。查找所有相互后续对(上面的示例中的对是 123,345)。当列表超出内存时,如何使用 Map / Reduce 来解决问题?
Capital One
Data Engineer What is Hadoop serialization?
(对数据工程师)什么是 Hadoop 序列化(serialization)?
Explain a simple Map/Reduce problem.
阐述一个简单的 Map / Reduce 问题。
Hive
Data Engineer Write a Hive UDF that returns a sentiment score. For example, if good = 1, bad = -1, and average = 0, then a review of a restaurant states “Good food, bad service,” your score might be 1 – 1 = 0.
(数据工程师)请编写返回情感分数的 Hive UDF。例如,假如好=1,坏=-1,平均数=0,那么对餐厅做评价时因为「食物好,服务差」,你的分数可能为 1 - 1 = 0
Spark
Capital One
Data Engineer Explain how RDDs work with Scala in Spark
(数据工程师)阐释使用 Scala 语言时RDD 在 Spark 中是如何工作的?
Statistics & Probability Questions
Explain Cross-validation as if you’re talking to a non-technical person.
请尝试向非技术人员阐释交叉验证(Cross-validation)。
Describe a non-normal probability distribution and how to apply it.
请描述一下非正态概率分布以及该如何应用?
Microsoft
Data Mining Explain what heteroskedasticity is and how to solve it
(数据挖掘)请解释异方差(heteroskedasticity)是什么,以及如何解决它。
Given Twitter user data, how would you measure engagement?
在给定 Twitter 用户数据的情况下,你该如何衡量参与度?
Uber
What are some different Time Series forecasting techniques?
时间序列预测技术有什么不同?
Explain Principle Component Analysis (PCA) and equations PCA uses.
解释原理组件分析(PCA)及其 使用的方程。
How do you solve Multicollinearity?
如何解决多重共线性(Multicollinearity)?
Analyst Write an equation that would optimize the ad spend between Twitter and Facebook.
(分析师)请尝试列出优化我们在 推特和脸书上的广告费用支出的方程。
What’s the probability you’ll draw two cards of the same suite from a single deck?
在一副牌中抽取两张,出现同一花色的概率是多少?
IBM
What are p-values and confidence intervals?
什么是 p-value 和置信区间?
Capital One
Data Analyst If you have 70 red marbles, and the ratio of green to red marbles is 2 to 7, how many green marbles are there?
(数据分析师)如果你有 70 个红色弹珠,绿色和红色弹珠的比例是 2 :7,有多少绿色弹珠?
What would the distribution of daily commutes in New York City look like?
纽约市的通勤数据看起来应该遵从什么分布?
Given a die, would it be more likely to get a single 6 in six rolls, at least two 6s in twelve rolls, or at least one-hundred 6s in six-hundred rolls?
一个骰子,在扔 6 次的情况下出现 1 个 6 的几率,与扔 12 次的情况下出现至少两个 6 的几率,和扔 600 次出现至少 100 次 6 的几率相比哪个大?
PayPal
What’s the Central Limit Theorem, and how do you prove it? What are its applications?
什么是中心极限定理(Central Limit Theorem),如何证明它?它的应用方向是什么?
Programming & Algorithms 编程和算法
Data Analyst Write a program that can determine the height of an arbitrary binary tree
(数据分析师)请写一个程序可以判定二叉树的高度。
Microsoft
Create a function that checks if a word is a palindrome.
请创建一个函数检查一个词是否具有回文结构。
Build a power set.
请构建一个幂集(power set)。
How do you find the median of a very large dataset?
请问如何在一个巨大的数据集中找到中值?
Uber
Data Engineer Code a function that calculates the square root (2-point precision) of a given number. Follow up: Avoid redundant calculations by now optimizing your function with a caching mechanism.
(数据工程师)编写一个函数用来计算给定数字的平方根(精确到百分位)。随后:避免冗余计算,现在使用缓存机制优化你的功能。
Suppose you’re given two binary strings, write a function adds them together without using any builtin string-to-int conversion or parsing tools. For example, if you give your function binary strings 100 and 111, it should return 1011. What’s the space and time complexity of your solution?
假设给定两个二进制字符串,写一个函数将它们添加在一起,而不使用任何内置的字符串到 int 转换或解析工具。例如:如果给函数二进制字符串 100 和 111,它应该返回 1011。你的解决方案的空间和时间复杂性如何?
Write a function that accepts two already sorted lists and returns their union in a sorted list.
编写一个函数,它接受两个已排序的列表,并在排序列表中返回它们的并集。
Data Engineer Write some code that will determine if brackets in a string are balanced
(数据工程师)请编写一些代码来确定字符串中的左右括号是否是平衡的?
How do you find the second largest element in a Binary Search Tree?
如何找到二叉搜索树中第二大的元素?
Write a function that takes two sorted vectors and returns a single sorted vector.
请编写一个函数,它接受两个排序的向量,并返回一个排序的向量。
If you have an incoming stream of numbers, how would you find the most frequent numbers on-the-fly?
如果你有一个输入的数字流,如何在运行过程中找到最频繁出现的数字?
Write a function that raises one number to another number, i.e. the pow() function.
编写一个函数,将一个数字增加到另一个数字,就像 pow()函数一样。
Split a large string into valid words and store them in a dictionary. If the string cannot be split, return false. What’s your solution’s complexity?
将大字符串拆分成有效字段并将它们存储在 dictionary 中。如果字符串不能拆分,返回 false。你的解决方案的复杂性如何?
Salesforce
What’s the computational complexity of finding a document’s most frequently used words?
查找文档最常用的词的计算复杂性是什么?
If you’re given 10 TBs of unstructured customer data, how would you go about finding extracting valuable information from it?
如果给你10 TBs的非结构化客户数据,你会如何发现提取有价值的信息呢?
Capital One
Data Engineer How would you ‘disjoin’ two arrays (like JOIN for SQL, but the opposite)?
(对数据工程师)如何「拆散」两个数列(就像 SQL 中的 JOIN 反过来)?
Create a function that does addition where the numbers are represented as two linked lists.
请创建一个用于添加的函数,数字表示为两个链表。
Create a function that calculates matrix sums.
请创建一个计算矩阵的函数。
How would you use Python to read a very large tab-delimited file of numbers to count the frequency of each number?
如何使用 Python 读取一个非常大的制表符分隔的数字文件,来计算每个数字出现的频率?
PayPal
Write a function that takes a sentence and prints out the same sentence with each word backwards in O(n) time.
请编写一个函数,让它能在 O(n)的时间内取一个句子并逆向打印出来。
Write a function that takes an array, splits the array into every possible set of two arrays, and prints out the max differences between the two array’s minima in O(n) time.
请编写一个函数,从一个数组中拾取,将它们分成两个可能的数组,然后打印两个数组之间的最大差值(在 O(n) 时间内)。
Write a program that does merge sort.
请编写一个执行合并排序的程序。
SQL Questions
Microsoft
Data Analyst Define and explain the differences between clustered and non-clustered indexes.
(数据分析师)定义和解释聚簇索引和非聚簇索引之间的差异。
Data Analyst What are the different ways to return the rowcount of a table?
(数据分析师)返回表的行计数有哪些不同的方法?
Data Engineer If you’re given a raw data table, how would perform ETL (Extract, Transform, Load) with SQL to obtain the data in a desired format?
(数据工程师)如果给定一个原始数据表,如何使用 SQL 执行 ETL(提取,转换,加载)以获取所需格式的数据?
How would you write a SQL query to compute a frequency table of a certain attribute involving two joins? What changes would you need to make if you want to ORDER BY or GROUP BY some attribute? What would you do to account for NULLS?
如何编写 SQL 查询来计算涉及两个连接的某个属性的频率表?如果你想要 ORDER BY 或 GROUP BY 一些属性,你需要做什么变化?你该怎么解释 NULL?
Data Engineer How would you improve ETL (Extract, Transform, Load) throughput?
(数据工程师)如何改进 ETL(提取,转换,加载)的吞吐量?
Brain Teasers & Word Problems
Suppose you have ten bags of marbles with ten marbles in each bag. If one bag weighs differently than the other bags, and you could only perform a single weighing, how would you figure out which one is different?
假设你有 10 包弹球,每包里面都是 10 个弹球。如果其中一包的重量和其他的不同,但你只能进行一次称重,你该用什么办法?
You are about to hop on a plane to Seattle and want to know if you should carry an umbrella. You call three friends of yours that live in Seattle and ask each, independently, if it’s raining.Each of your friends will tell you the truth ⅔ of the time and mess with you by lying ⅓ of the time. If all three friends answer “Yes, it’s raining,” what is the probability that is it actually raining in Seattle?
你打算坐飞机去西雅图,想知道是不是需要带伞,于是你分别打电话给三位在西雅图的朋友。每个朋友都有 2/3 的几率说真话,1/3 的几率在骗你。如果他们都说「会下雨」,西雅图下雨的概率是多少?
Uber
Imagine you are working with a hospital. Patients arrive at the hospital in a Poisson Distribution, and the doctors attend to the patients in a Uniform Distribution. Write a function or code block that outputs the patient’s average wait time and total number of patients that are attended to by doctors on a random day.
想象一下你在一家医院工作。患者来就诊的频率符合泊松分布,而医生照顾患者的频率符合均匀分布。请写一个函数或一段代码来输出患者的平均等待时间和医生在某日的参与度。
Imagine there are three ants in each corner of an equilateral triangle, and each ant randomly picks a direction and starts traversing the edge of the triangle. What’s the probability that none of the ants collide? What about if there are N ants sitting in N corners of an equilateral polygon?
假如在一个等边三角形的三个角上都有一只蚂蚁,每只随机选择方向然后直走一直到另一个边缘,三只蚂蚁互相不交汇的几率是多少?如果有 n 只蚂蚁在 n 角形中,概率又是多少?
How many trailing zeros are in 100 factorial (i.e. 100!)?
在 100! 的结果里有多少个零?
Imagine you’re climbing a staircase that contains n stairs, and you can take any number k steps. How many distinct ways can you reach the top of the staircase? (This is a modification of the original stair step problem)
你正在攀爬一个 n 阶的楼梯,你可以采取任何数量的 k 个步骤。你到达楼梯顶部有多少不同的方式?(这是楼梯问题的修改版)
公众号后台回复关键词“区块链”
获取区块链最新报告
扫码进入知识分享社群
交流~共享~学习~进步
公众号后台回复“sq”,加入社群
往期热文:
往期报告:
深度 丨 温度 丨 态度
长按二维码
关注悟空智能