回复: 52
跳转到指定楼层
上一主题 下一主题
收起左侧

Stripe电面

 
🔗
匿名用户-3JTHB  2021-1-27 04:33:26 |倒序浏览

2021(1-3月) 码农类General 硕士 全职@stripe - 网上海投 - 技术电面  | | Other | 在职跳槽

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

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

x
Part 1

In an HTTP request, the Accept-Language header describes the list of
languages that the requester would like content to be returned in. The header
takes the form of a comma-separated list of language tags. For example:

  Accept-Language: en-US, fr-CA, fr-FR

means that the reader would accept:

  1. English as spoken in the United States (most preferred)
  2. French as spoken in Canada
  3. French as spoken in France (least preferred)

We're writing a server that needs to return content in an acceptable language
for the requester, and we want to make use of this header. Our server doesn't
support every possible language that might be requested (yet!), but there is a
set of languages that we do support. Write a function that receives two arguments:
an Accept-Language header value as a string and a set of supported languages,
and returns the list of language tags that will work for the request.
您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限查看其他获取积分的方式
Unlock interview details and practice with AI
Curated Interview Questions from Top Companies
t;, "fr-BG", "fr-CA"]

parse_accept_language("fr-FR;q=1, fr-CA;q=0, *;q=0.5", ["fr-FR", "fr-CA", "fr-BG", "en-US"])
returns: ["fr-FR", "fr-BG", "en-US", "fr-CA"]

parse_accept_language("fr-FR;q=1, fr-CA;q=0.8, *;q=0.5", ["fr-FR", "fr-CA", "fr-BG", "en-US"])

最后一小问我的想法是记录每个supported tag的q factor,比如一开始大家的q factor都是-1。然后根据用户输入,有*的话先处理*,接下来处理单独的language(比如fr, en)如果有的话,最后处理完整的tag(比如fr-FR, en-US),每次都更新对应的supported tag的q factor,最后选出所有q factor不是-1的supported tag然后根据q factor排序输出。这道题现场没写完,只说了个大概思路。

评分

参与人数 20大米 +45 收起 理由
Philosophie + 2 给你点个赞!
tramplon + 1 给你点个赞!
casttree + 1 给你点个赞!
jianjin2046 + 1 很有用的信息!
Falldawn + 1 给你点个赞!

查看全部评分


上一篇:脸 Oculus intern 面经
下一篇:阅后即焚电面

本帖被以下淘专辑推荐:

推荐
小羊ZNMO 2021-10-27 13:27:53 | 只看该作者
全局:
第2、3问 我觉得可以用LinkedHashSet,既能排序,也能去重?
回复

使用道具 举报

推荐
Falldawn 2021-6-20 02:33:00 | 只看该作者
全局:
lloydrodman 发表于 2021-6-20 02:26
没必要这么复杂吧,直接在headers里顺序看是不是支持, 是的话加到res里不就行了?

是,我后面的帖子写了
回复

使用道具 举报

推荐
lloydrodman 2021-6-20 02:26:04 | 只看该作者
全局:
Falldawn 发表于 2021-6-13 00:25
第一问类似于953. Verifying an Alien Dictionary,需要保持顺序,直接用index作为顺序即可。然后可以用min ...

没必要这么复杂吧,直接在headers里顺序看是不是支持, 是的话加到res里不就行了?
回复

使用道具 举报

🔗
tm1234 2021-1-27 12:09:37 来自APP | 只看该作者
全局:
请问lz他家需要编译运行code 并且跑test case吗?
回复

使用道具 举报

地里匿名用户
🔗
匿名用户-3JTHB  2021-1-31 09:43:17
tm1234 发表于 2021-1-27 12:09
请问lz他家需要编译运行code 并且跑test case吗?

需要的。
回复

使用道具 举报

🔗
grokus 2021-2-1 10:52:30 | 只看该作者
全局:
Was this phone screen or onsite?
回复

使用道具 举报

🔗
tobebeyond 2021-2-1 12:27:04 | 只看该作者
全局:
grokus 发表于 2021-2-1 10:52
Was this phone screen or onsite?

电面 紫薯紫薯。。。。
回复

使用道具 举报

🔗
2011051305 2021-2-1 12:50:32 | 只看该作者
全局:
stripe要求分前端后端吗? 这种parse问题感觉用js或者python能快点完成。
回复

使用道具 举报

地里匿名用户
🔗
匿名用户-3JTHB  2021-2-2 14:07:18
2011051305 发表于 2021-2-1 12:50
stripe要求分前端后端吗? 这种parse问题感觉用js或者python能快点完成。

我不太确定你问的前端后端是什么意思。这题我觉得主要不在于parse input,还是如何写算法去match。
回复

使用道具 举报

🔗
xiongxicheng 2021-2-2 14:13:47 | 只看该作者
全局:
请问楼主面的是什么组啊
回复

使用道具 举报

地里匿名用户
🔗
匿名用户-3JTHB  2021-2-2 14:25:23
xiongxicheng 发表于 2021-2-2 14:13
请问楼主面的是什么组啊

我面的是data infrastructure engineer。
回复

使用道具 举报

🔗
hackenkreuz 2021-2-9 06:19:15 | 只看该作者
全局:
LZ电面过了吗,我的电面题也是一模一样,但是45分钟一到面试官居然不继续问第4个了。前3问面试官花了好多时间跑testcase, 大多数时间都烧在这上面了
回复

使用道具 举报

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

本版积分规则

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