We’re preparing your current view and syncing the latest data.
Given the list watchedVideos, where watchedVideos[i] is the list of videos watched by the ith user, and the friendship list friends, where friends[i] is the list of friend IDs of the ith user, find the videos watched by friends at a specific level from the given user. The level is the distance in the friendship graph from the given user. Return the videos sorted first by frequency (ascending) then lexicographically by name.
watchedVideos: List[List[str]], friends: List[List[int]], id: int, level: int
List[str] sorted by frequency and name
2 <= watchedVideos.length == friends.length <= 100 1 <= watchedVideos[i].length <= 100 1 <= watchedVideos[i][j].length <= 8 0 <= id < watchedVideos.length 0 <= level < watchedVideos.length
Example 1
Input
watchedVideos = [["A","B"],["C"],["B","C"],["D"]], friends = [[1,2],[0,3],[0,3],[1,2]], id = 0, level = 1
Output
["B","C"]
Explanation
Friends at level 1 from user 0 are users 1 and 2. Aggregating their watched videos: user 1 has ["C"], user 2 has ["B","C"]. Video frequencies are B:1, C:2. Sorted by frequency then lex order: B, C.