<button id="ysiwy"><noscript id="ysiwy"></noscript></button>
    <input id="ysiwy"></input>
  • <input id="ysiwy"></input>
  • <del id="ysiwy"></del>
    <s id="ysiwy"><kbd id="ysiwy"></kbd></s>
    <del id="ysiwy"></del>
      • 每日一練|DataScientist&BusinessAnalyst&Leetcode面試題679

        編輯:大數據應用2019-08-30 00:05:19 關鍵字:&,the,people,new,or,Analyst,Data,Given,place,領域,class,place,will,array,Answer

        原標題:每日一練 | Data Scientist & Business Analyst & Leetcode 面試題 679

        Aug.

        19

        Data Application Lab 自2017年6月15日起,每天和你分享討論一道數據科學(DS)和商業分析(BA)領域常見的面試問題。

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

        希望積極尋求相關領域工作的你每天關注我們的問題并且與我們一起思考,我們將會在第二天給出答案。

        Day

        579

        DS Interview Question

        What’s the disadvantages of linear regression?

        BA Interview Question

        Human Traffic of Stadium

        X city built a new stadium, each day many people visit it and the stats are saved as these columns: id, date, people

        Please write a query to display the records which have 3 or more consecutive rows and the amount of people more than 100(inclusive).

        For example, the table stadium:

        +------+------------+-----------+

        | id | date | people |

        +------+------------+-----------+

        | 1 | 2017-01-01 | 10 |

        | 2 | 2017-01-02 | 109 |

        | 3 | 2017-01-03 | 150 |

        | 4 | 2017-01-04 | 99 |

        | 5 | 2017-01-05 | 145 |

        | 6 | 2017-01-06 | 1455 |

        | 7 | 2017-01-07 | 199 |

        | 8 | 2017-01-08 | 188 |

        +------+------------+-----------+

        For the sample data above, the output is:

        +------+------------+-----------+

        | id | date | people |

        +------+------------+-----------+

        | 5 | 2017-01-05 | 145 |

        | 6 | 2017-01-06 | 1455 |

        | 7 | 2017-01-07 | 199 |

        | 8 | 2017-01-08 | 188 |

        +------+------------+-----------+

        LeetCode Question

        Remove Element

        Deion:

        Given an array and a value, remove all instances of that value in place and return the new length.

        Do not allocate extra space for another array, you must do this in place with constant memory.

        The order of elements can be changed. It doesn’t matter what you leave beyond the new length.

        Input: [3,2,2,3]

        Output: 2

        Assumptions:

        Do not allocate extra space for another array, you must do this in place with constant memory.

        Day

        578

        答案揭曉

        DS Interview Question & Answer

        If I double every sample observation in a linear regression model, how will the coefficients, r-squared value and t-value change?

        Answer:

        The coefficients will be the same (for the analytical solution will not be affected).

        R-squared value will be the same (please refer to the definition of R-squared value).

        每日一練|DataScientist&BusinessAnalyst&Leetcode面試題679

        T-value will be roughly sqrt(2) times the previous t value:

        每日一練|DataScientist&BusinessAnalyst&Leetcode面試題679

        Reference:

        https://stats.stackexchange.com/questions/19698/if-i-repeat-every-sample-observation-in-a-linear-regression-model-and-rerun-the

        http://reliawiki.org/index.php/Simple_Linear_Regression_Analysis

        https://en.wikipedia.org/wiki/Coefficient_of_determination

        https://en.wikipedia.org/wiki/Student%27s_t-test

        BA Interview Question & Answer

        Classes More Than 5 Students

        There is a table courses with columns: student and class

        Please list out all classes which have more than or equal to 5 students.

        For example, the table:

        +---------+------------+

        | student | class |

        +---------+------------+

        | A | Math |

        | B | English |

        | C | Math |

        | D | Biology |

        | E | Math |

        | F | Computer |

        | G | Math |

        | H | Math |

        | I | Math |

        +---------+------------+

        Should output:

        +---------+

        | class |

        +---------+

        | Math |

        +---------+

        Answer:

        Approach: Using GROUP BY clause and sub-query [Accepted]

        Intuition

        First, we can count the student number in each class. And then select the ones have more than 5 students.

        Algorithm

        To get the student number in each class. We can use GROUP BY and COUNT, which is very popular used to statistic bases on some character in a table.

        SELECT

        class, COUNT(DISTINCT student)

        FROM

        courses

        GROUP BY class

        ;

        Note: We use DISTINCT here since the student name may duplicated in a class as it is mentioned int he problem deion.

        | class | COUNT(student) |

        |----------|----------------|

        | Biology | 1 |

        | Computer | 1 |

        | English | 1 |

        | Math | 6 |

        To continue, we can filter the classes by taking the above query as a sub-query.

        SELECT

        class

        FROM

        (SELECT

        class, COUNT(DISTINCT student) AS num

        FROM

        courses

        GROUP BY class) AS temp_table

        WHERE

        num >= 5

        ;

        Note: Make an alias of COUNT(student) ('num' in this case) so that you can use in the WHERE clause because it cannot be used directly over there.

        Approach: Using GROUP BY and HAVING condition [Accepted]

        Algorithm

        Using sub-query is one way to add some condition to a GROUP BY clause, however, using HAVING is another simpler and natural approach. So we can rewrite the above solution as below.

        MySQL

        SELECT

        class

        FROM

        courses

        GROUP BY class

        HAVING COUNT(DISTINCT student) >= 5

        ;

        Reference: https://leetcode.com/problems/classes-more-than-5-students/deion/

        LeetCode Question & Answer

        Remove Duplicate

        Deion:

        Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length

        Do not allocate extra space for another array, you must do this in place with constant memory.

        Input: [1,1,2]

        Output: 2

        Assumptions:

        Do not allocate extra space for another array, you must do this in place with constant memory.

        Solution:這是一道非常基礎的去重題目,需要細心設定兩個指針并考慮好邊界條件。

        Code:

        每日一練|DataScientist&BusinessAnalyst&Leetcode面試題679

        時間復雜度:O(n)

        空間復雜度:O(1)

        責任編輯:

        相關文章
        6月中國廠商出海收入30強榜單公布:騰訊排名下滑 掌趣科技、易幻網絡跌出榜單

        6月中國廠商出海收入30強榜單公布:騰訊排名下滑 掌趣科技、易幻網絡跌出榜單

        中國網科技7月30日訊(記者 李婷)市場研究機構App Annie近日發布2020年6月中國廠商出海收入30強榜單,FunPlus(趣加)取代[詳情]

        凱迪拉克怎么了?

        凱迪拉克怎么了?

        題圖:GM authority隨著 2020 年新冠疫情逐步趨穩,很多事已經沒法再讓疫情背鍋了。先是跌入谷底,再是觸底回升,上半年國內汽[詳情]

        運載火箭可用固體燃料 美再為韓國研制彈道導彈“松綁”

        運載火箭可用固體燃料 美再為韓國研制彈道導彈“松綁”

        據韓聯社首爾7月28日報道,韓國7月28日宣布,根據與美國達成的新導彈指南,該國已能研發使用固體推進劑的火箭。他在新聞發布[詳情]

        意大利餐廳服務員確診 追蹤發現某些顧客留假信息

        意大利餐廳服務員確診 追蹤發現某些顧客留假信息

        歐聯網7月30日電,據歐聯通訊社報道,意大利坎帕尼亞大區衛生部門28日通報,當日該地區新增確診病例29例,那不勒斯省維科·埃[詳情]

        元晟溱:柯潔很有才能 他與李世石風格相似卻不同

        元晟溱:柯潔很有才能 他與李世石風格相似卻不同

        韓國棋手元晟溱九段  據韓國烏鷺網報道,韓國棋手元晟溱在10多歲的時候就已經達到了世界超一流棋手的水平。在20歲中期[詳情]

        contact us

        Copyright     2018-2020   All rights reserved.
        欧美日韩国产高清一区二区三区,国产欧美综合一区二区,欧美黑人巨大3dvideo,亚洲视频在线一区二区三区
        <button id="ysiwy"><noscript id="ysiwy"></noscript></button>
          <input id="ysiwy"></input>
        • <input id="ysiwy"></input>
        • <del id="ysiwy"></del>
          <s id="ysiwy"><kbd id="ysiwy"></kbd></s>
          <del id="ysiwy"></del>
            • 主站蜘蛛池模板: 最近中文国语字幕在线播放 | 高h全肉动漫在线观看| 欧美区在线播放| 国产精品美女www爽爽爽视频| 国产精品久久久久影视不卡| 亚洲欧美天堂网| 91福利视频合集| 欧美成人手机在线视频| 少妇BBB好爽| 午夜dj在线观看免费高清在线 | 99久久国产免费福利| 色窝窝无码一区二区三区成人网站| 日韩中文字幕在线视频| 国产精品亚洲片在线观看不卡 | 在线播放国产视频| 亚洲精品国产综合久久一线| 丝瓜app免费下载网址进入ios| 老师那里好大又粗h男男| 晚上看b站直播软件| 国产又大又粗又猛又爽的视频| 久久国产亚洲观看| 精品福利视频网站| 日本特黄特色aaa大片免费| 国产一区第一页| 一本大道香蕉最新在线视频| 福利视频第一页| 引诱亲女乱小说完整版18| 国产a级一级久久毛片| 久久久噜噜噜久久中文字幕色伊伊 | 在线免费观看毛片网站| 亚洲日本黄色片| 亚洲宅男精品一区在线观看| 日韩精品亚洲一级在线观看| 国产精品亚洲а∨天堂2021| 五月婷婷在线播放| 草莓视频污在线观看| 强迫的护士bd在线观看| 亚洲精品在线免费观看视频| 亚洲人成网站看在线播放| 日本丰满岳乱妇在线观看| 午夜免费1000部|