注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号
x
店面:
/
*
A game has n players all collecting different kinds of animals. Each player has some number of each type of animal. For example:
// Player Cows Pigs Total
// Mike 3 2
// Alex 5 1
// Tess 4 4
To calculate each player’s total score for the game, we evaluate each category separately. For each category, the player with the most of that animal gets n points, which is the number of players in the game. Second place gets n-1, down to the player with the fewest of that animal getting one point. Then the total score is the sum of the category scores. For example:
typ
// Player Cows Pigs Total
// Mike 3 (1) 2 (2) 3
// Alex 5 (3) 1 (1) 4
// Tess 4 (2) 4 (3) 5
where the numbers in parentheses are the points awarded.
Part 1: Given the input data above, return the total score for each player. The players don’t need to be in any particular order, and I don’t need the component scores - just something like “Mike 3, Alex 4, Tess 5”. Use whatever data structure you want to represent the input data and the game state, but note that the number and names of players and categories are defined by the input data.
Part 2: When two or more players are tied, rather than arbitrarily giving one player more points, we’d like to divide up the points fairly. The best way to do that is to average the points the tied players would get, like so:
Player 1: 9 cows (4 points)
Player 2: 7 cows (2.5 points, the average of 3 and 2)
Player 3: 7 cows (2.5 points)
Player 4: 4 cows (1 point)
or
Player 1: 9 cows (4 points)
Player 2: 7 cows (2 points, the average of 3 and 2 and 1)
Player 3: 7 cows (2 points)
Player 4: 7 cows (2 points)
Modify your code to handle ties.
How would you handle it if we wanted to allow custom scoring for certain animals? For example, for cows you might get an extra point for having an even number, or for pigs you might want to have the fewest pigs instead of the most.
What would you do if you had orders of magnitude more players than categories? What if you had a very large number of players and categories and access to an AWS instance?
*/
VO:
coding1:
Part 1
We have a clunky timecard system in our offi您好! 本帖隐藏的内容需要积分高于 188 才可浏览 您当前积分为 0。 使用VIP即刻解锁阅读权限或查看其他获取积分的方式 游客,您好! 本帖隐藏的内容需要积分高于 188 才可浏览 您当前积分为 0。 VIP即刻解锁阅读权限 或 查看其他获取积分的方式 quot;, "kai" ] },
{ "start": "17:00", "end": "17:45", "ids": [ "arjun", "kai" ] },
{ "start": "17:45", "end": "18:50", "ids": [ "kai" ] }
]
coding2:
https://www.1point3acres.com/bbs/thread-887966-1-1.html
Leadership + project deepdive + SD
系统设计recruiter告诉我是stock trading platform,结果考的是酒店预订,服了。
我觉得我面试挺好的,最后feedback我着实get不到,乱七八糟的点。 |