FINRA Engineer QuestionnaireWithin this document are four different questions. Each question is structured in the following manner:1)Premise - Contains any needed background information2)Request- The actual question, what you are to solve3)Notes- A space if you feel like including notes of any kind for the given questionPlease place your answer for each question in a separate file, following this naming convention:FINRA_Qn.txt, where n = the question number (i.e., 1, 2 ...). So the file for the first question should be named ‘FINRA_Q1.txt’Reponses can be code or pseudocode, with higher preference given to actual coded solutions. If a specific language is not requested by the question, please indicate the chosen language within a comment at the top of your solution. If you feel it necessary, add comments to parts of your solutions.When complete, please package everything together and send email responses to the designated POCs.Premise:You have a table with one column, `original_date`, of datatype stringORIGINAL_DATE2019082520190826201908272019082820190829201908302019083120190901Question:Write a (preferably hive) SQL query to calculate two more columns – 1)`end_of_week ` - the date of the next Sunday from `original_date`. If `original_date` is already a Sunday, this field should be the same value2)`end_of_month ` - the value of the end of month dateAn acceptable solution is one which works for any valid date in the string format of `original_date`.Desired Result:ORIGINAL_DATE END_OF_WEEK END_OF_MONTH20190825 20190825 2019083120190826 20190901 2019083120190827 20190901 2019083120190828 20190901 2019083120190829 20190901 2019083120190830 20190901 2019083120190831 20190901 2019083120190901 20190901 20190930Additional Info: 20190825 is a Sunday, so the `end_of_week` for that value is still that same date. 20190827 is a Tuesday, and the next Sunday is on 20190901Notes:Premise:You have a table `Activity`, with fields `ID`, `start_time`, and `end_time`. These fields are all of datatype string.ID START_TIME END_TIME100 10:00 12:00100 10:15 12:30100 12:15 12:45100 13:00 14:00200 10:15 10:30… … …Question:Write a (preferably hive) SQL query to create a new field `group_id` which identifies records within each `ID` that have overlapping `start_time` and `end_time` intervals. An acceptable solution will have a unique `group_id` for each `ID` and overlapping set of intervals.Desired Example: ID START_TIME END_TIME GROUP_ID100 10:00 12:00 1100 10:15 12:30 1100 12:15 12:45 1100 13:00 14:00 2200 10:15 10:30 3Additional Info: For a given `ID`, if any of its intervals overlap then the corresponding records belong to the same group, and thus should have the same `group_id`. A recordata留学生作业代做、代写SQL实验作业、SQL编程有作业调试、pseudocode课程作业代写 调试Matlab程序d A overlaps another record B when A’s `start_time` and/or `end_time` is between B’s `start_time` and `end_time`.In the example, `ID` = 100 has four intervals. The first three overlap => the second record overlaps with the first (the `start_time` of 10:15 is between the `start_time` and `end_time` of 10:00 to 12:00) and the third overlaps with the second (the `start_time` of 12:15 is between the `start_time` and `end_time` of 10:15 to 12:30). Because of this, they all have the same `group_id` of 1. The fourth interval for `ID` = 100 does not overlap any of the other intervals within that `ID`, and so it becomes its own group with a new `group_id`. The last record has a completely different `ID` and so it starts a third group also with a new `group_id`.Notes:Premise:Tracy has a file that contains a list of actors and the movies in which they acted. She wants to know the top 10 actors from her list whom have acted in the most movies.ACTOR_NAME MOVIE_NAMELeonardo DiCaprio The RevenantSamuel L. Jackson Pulp FictionTom Cruise Mission ImpossibleLeonardo DiCaprio The Great Gatsby… … Question:Write code (or pseudocode) in your favorite programming language to display the 10 actors appearing in the most movies, and the count of movies in which they have acted. If there are less than 10 actors in her list, display all of them.Consider all scenarios - such as, if two actors have acted in the same number of movies, they will have the same rank. Notes:Premise:Adam is so good at playing arcade games that he will win at every game he plays. One fine day as he was walking on the street, he discovers an arcade store that pays real cash for every game that the player wins - however, the store will only pay out once per game. The store has 10 games for which they will pay winners, and each game has its own completion time and payout rate. Thrilled at the prospect of earning money for his talent, Adam walked into the store only to realize that the store closes in 2 hours (exactly 120 minutes). Knowing that he cannot play all the games in that time, he decides to pick the games that maximize his earningsGAME COMPLETION_TIME (in minutes) PAYOUT_RATEPac-man 75 $250Speed Racer 45 $280Pump it Up 30 $150Space Invaders 35 $120Mario Bros 30 $200Mortal Kombat 15 $100Atari Breakout 60 $300Super Tetris 90 $350Star Wars 20 $110Street Fighter II 10 $90Question:Write code (or pseudocode) in your favorite programming language to help Adam pick the sequence(s) of games that earn him the most money?.Then, assume you have a variable list of games and their payout rates. What is the best way to pick the games that earn you the most?An acceptable solution is a workable solution that accounts for all the different scenarios in a variable list of games with their completion times and payout rates.Notes:转自:http://www.6daixie.com/contents/15/4560.html
网友评论