注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号 
x
不算难。
/*
We are building a social network where users can like and share content from the web.
Given a list of users and content that each user liked, find the user most similar to User X. "Most similar to X" means the person who liked the greatest number of unique pieces of content that User X also liked.
For example, User1 liked 3 distinct pages. User3 liked all 3 of those pages, more than anyone else, making them the most similar user to User1.
Sample input:
# Content, user ID, timestamp
user_content_likes = [
["http://yahoo.com", "user3", "2019991", "99999"},
{"http://geocities.com", "user1", "100007"},
input: user1 {goog, yahoo, sthelse}
?
get all other users, get their like list, and compare the list with user1
user1: {goog, yahoo} Map<user, Set(url)
1
----------------------------
user2: {goog, yahoo, altavista, hjhgjhg,hjjjj, yyy} +1
user22: {goog, yahoo } +1
user3: {goog } +1
*/
|