回复: 5
收起左侧

square 挂经

本楼:   👍  2
100%
0%
0   👎
全局:   65
76%
24%
21

2024(1-3月) 码农类General 本科 全职@square - 网上海投 - 技术电面 Onsite  | 😐 Neutral 😐 AverageFail | 在职跳槽

注册一亩三分地论坛,查看更多干货!

您需要 登录 才可以下载或查看附件。没有帐号?注册账号

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不到,乱七八糟的点。

评分

参与人数 4大米 +13 收起 理由
tiantianup + 1 给你点个赞!
清道神君 + 10 欢迎分享你知道的情况,会给更多大米奖励!
zerx_java + 1 很有用的信息!
kebugcheck + 1 给你点个赞!

查看全部评分


上一篇:讨论一道亚麻oa
下一篇:sig QR hr面
 楼主| suitianshiwo 2024-2-23 22:59:39 来自APP | 显示全部楼层
本楼:   👍  1
100%
0%
0   👎
全局:   65
76%
24%
21
匿名用户 发表于 2024-02-22 22:55:34
square不是去年底就不招人了吗,我朋友面过了组好像没match上,也gg了,楼主方便透露下投的什么组吗
Payout
回复

使用道具 举报

地里匿名用户
匿名用户-O34T7  2024-2-23 14:55:34
本楼:   👍  0
0%
0%
0   👎
square不是去年底就不招人了吗,我朋友面过了组好像没match上,也gg了,楼主方便透露下投的什么组吗
扫码关注一亩三分地求职移民公众号
更多干货内容等你发现
回复

使用道具 举报

地里匿名用户
匿名用户-KUJSU  2024-2-27 13:35:43
本楼:   👍  0
0%
0%
0   👎
楼主有没有timeline?求分享
回复

使用道具 举报

wocaole 2024-7-13 23:39:26 来自APP | 显示全部楼层
本楼:   👍  0
0%
0%
0   👎
全局:   814
97%
3%
22
请问楼主,on-site的第一题除了N方的暴力解法,还有什么更优解吗?

补充内容 (2024-07-16 00:13 +08:00):

Nvm, 知道了咋搞了。
回复

使用道具 举报

地里匿名用户
匿名用户-DCWP0  2024-8-27 08:26:04
本楼:   👍  0
0%
0%
0   👎
LZ Leadership 面什么?
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册账号
隐私提醒:
  • ☑ 禁止发布广告,拉群,贴个人联系方式:找人请去🔗同学同事飞友,拉群请去🔗拉群结伴,广告请去🔗跳蚤市场,和 🔗租房广告|找室友
  • ☑ 论坛内容在发帖 30 分钟内可以编辑,过后则不能删帖。为防止被骚扰甚至人肉,不要公开留微信等联系方式,如有需求请以论坛私信方式发送。
  • ☑ 干货版块可免费使用 🔗超级匿名:面经(美国面经、中国面经、数科面经、PM面经),抖包袱(美国、中国)和录取汇报、定位选校版
  • ☑ 查阅全站 🔗各种匿名方法

本版积分规则

>
快速回复 返回顶部 返回列表