自2017年6月15日起,数据应用学院与你一起温习数据科学(DS)和商业分析(BA)领域常见的面试问题。从2017年10月4号起,每天再为大家分享一道Leetcode算法题。
希望积极寻求相关领域工作的你每天关注我们的问题并且与我们一起思考,我们将会在第二天给出答案。
Day 211 
DS Interview Questions
Explain what resampling methods are and why they are useful.
BA Interview Questions
R language:
Write a nested loop, where the outer for() loop increments “a” 3 times, and the inner for() loop increments “b” 3 times.
The break statement exits the inner for() loop after 2 incrementations.
The nested loop prints the values of variables, “a” and “b“.
**The break statement is used within loops to exit from the loop.
If the break statement is within a nested loop, the inner loop is exited, and the outer loop is resumed.
LeetCode Questions
Description:Write a function to find the longest common prefix string amongst an array of strings.Input:[“aasdfgas”, “aaasafda”]Output:“aa”
欲知答案如何?请见下期分解!
Day 210 答案揭晓
DS Interview Questions
What is cross-validation? How to do it right?
Cross Validation is generally used to assess the error of given models and select the most appropriate model.
Steps:
  1. Divide the sample data into training set and test set;
  2. Partition the training data into k equal-sized folds;
  3. For k = 1,2,...,K, fit the model to the other K-1 folds and calculate the prediction error on the k-th component.
  4. Take the average of the prediction errors as an estimate of model performance; select the model that results in the lowest average prediction error;
  5. Train the selected model on the entire training data and test on the held-out test set.  The prediction error is an estimate of the model’s performance in the real world.
BA Interview Questions
R language:
Using i <- 1, write a while() loop that prints the variable, “i“, (that is incremented from 1 – 5), and uses break to exit the loop if “i” equals 3.
i <- 1
while(i<5){
 print(i)
 if(i==3) break;
 i=i+1
}
  Leetcode Questions
  • Description:
  • The count-and-say sequence is the sequence of integers with the first five terms asfollowing:
  • 1 is read off as “one 1” or 11.
  • 11 is read off as “two 1s” or 21.
  • 21 is read off as “one 2, then one 1” or 1211.
  • Given an integer n, generate the nth term of the count-and-say sequence.
  • Note: Each term of the sequence of integers will be represented as a string.
  • Input: 4
  • Output: “1211”
Solution:
  • 模拟题,按照题目的原意模拟过程
  • 注意corner case,比如1的时候
Code:

点击“阅读原文”查看数据应用学院核心课程
继续阅读
阅读原文