注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号
x
来报个面经 攒大米
麻烦被帮助到的童鞋给我加下大米啊啊啊。
题目还是地里以前的面经, 我是用IDE 做得, 面试官小哥很满意, 做完还有20分钟剩下 随便闲聊一下就过去了。
/**
*
/*
Your previous Plain Text content is preserved below:
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 laby an asterisk, which means "all other languages". Extend your function to
support the wildcard entry.
Examples:
parse_accept_language("en-US, *", ["en-US", "fr-CA", "fr-FR"])
returns: ["en-US", "fr-CA", "fr-FR"]
parse_accept_language("fr-FR, fr, *", ["en-US", "fr-CA", "fr-FR"])
returns: ["fr-FR", "fr-CA", "en-US"]
*/
|