注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号
x
发一个刚刚面的Karat的新鲜面经
两道题:
1.// We have some clickstream data that we gathered on our client's website. Using cookies, we collected snippets of users' anonymized URL histories while they browsed the site. The histories are in chronological order and no URL was visited more than once per person.
// Write a function that takes two user’s browsing histories as input and returns the longest contiguous sequence of URLs that appears in both.
// Sample input:
// user0 = [ "/start.html", "/pink.php", "/register.asp", "/orange.html", "/red.html" ]
// user1 = [ "/red.html", "/green.html", "/blue.html", "/pink.php", "/register.asp" ]
// user2 = [ "/utput (in any order):
// 1320 com
// 900 google.com
// 410 yahoo.com
// 60 mail.yahoo.com
// 10 mobile.sports.yahoo.com
// 50 sports.yahoo.com
// 10 stackoverflow.com
// 3 org
// 3 wikipedia.org
// 2 en.wikipedia.org
// 1 es.wikipedia.or
其实这两个提都不难,然而楼主没有看清第一题的要求,写了一个错的答案。。。。。
补充内容 (2018-10-12 02:32):
新人求大米!没有大米寸步难行!多谢多谢 |