补充内容 (2019-12-22 13:19):
Tech: Given 2 helper methods,
public List<Video> getWatchedVideos(Person person) {
// Return a list of Video objects that has been watched by the given person
}
public List<Person> getFriends(Person person) {
// Return a list of Person objects who are the friends of the given person
}
Write a method to return a list of ALL videos that have been watched by a given person’s immediate friends,
* The videos in the returned list should be sorted by the frequencies that it was watched
* The videos in the returned list contain only videos that hasn’t been watched by the given person
The method signature:
public List<Video> mostWatchedVideosFromFriends(Person person) {
//
}
Follow up: How to implement a method to return a list of ALL videos that have been watched by a given person’s friends, friends of friends, friends of friends of friends, etc. The level of friends of friends is an integer larger than 0, e.g.,
public List<Video> mostWatchedVideosFromFriends(Person person, int friendsOfFriendsLevel) {
// If friendsOfFriendsLevel = 1, the follow up question becomes the original question
}