每日一练 | Data Scientist & Business Analyst & Leetcode 面试题 311
自2017年6月15日起,数据应用学院与你一起温习数据科学(DS)和商业分析(BA)领域常见的面试问题。从2017年10月4号起,每天再为大家分享一道Leetcode算法题。
希望积极寻求相关领域工作的你每天关注我们的问题并且与我们一起思考,我们将会在第二天给出答案。
DS Interview Questions
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
Cross Validation is generally used to assess the error of given models and select the most appropriate model.
Steps:
- Divide the sample data into training set and test set;
- Partition the training data into k equal-sized folds;
- For k = 1,2,...,K, fit the model to the other K-1 folds and calculate the prediction error on the k-th component.
- Take the average of the prediction errors as an estimate of model performance; select the model that results in the lowest average prediction error;
- 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:
点击“阅读原文”查看数据应用学院核心课程
最新评论
推荐文章
作者最新文章
你可能感兴趣的文章
Copyright Disclaimer: The copyright of contents (including texts, images, videos and audios) posted above belong to the User who shared or the third-party website which the User shared from. If you found your copyright have been infringed, please send a DMCA takedown notice to [email protected]. For more detail of the source, please click on the button "Read Original Post" below. For other communications, please send to [email protected].
版权声明:以上内容为用户推荐收藏至CareerEngine平台,其内容(含文字、图片、视频、音频等)及知识版权均属用户或用户转发自的第三方网站,如涉嫌侵权,请通知[email protected]进行信息删除。如需查看信息来源,请点击“查看原文”。如需洽谈其它事宜,请联系[email protected]。
版权声明:以上内容为用户推荐收藏至CareerEngine平台,其内容(含文字、图片、视频、音频等)及知识版权均属用户或用户转发自的第三方网站,如涉嫌侵权,请通知[email protected]进行信息删除。如需查看信息来源,请点击“查看原文”。如需洽谈其它事宜,请联系[email protected]。