FastPrepRecommend Films from Viewers Who Watched Everything You Did
Problems/Recommend Films from Viewers Who Watched Everything You Did

Recommend Films from Viewers Who Watched Everything You Did

Bloomberg LP logoBloomberg LP● EasyFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Bloomberg asked this in the same technical phone screen as the coin question. Given each existing user's watched films and a new user's list, the task was to keep only the users whose history contains all of the new user's films. Then count how many of them watched each film the new user has not seen, and recommend those films from most to fewest viewers. The candidate's small example (two of three users kept, one film with two viewers ahead of two films with one) is reused as Example 1.

The report did not say how ties are ordered, how films and users are represented, or give limits. Our choices here: users are a list of film lists. Film names are 1 to 10 lowercase letters or digits, with no repeats inside one list. Ties are broken by film name in plain string order. When the new user watched nothing, every user is kept. The answer is empty when nothing qualifies. There are up to 1000 users with up to 50 films each.

Our version is about 90% the same as the reported question.

A streaming service knows which films each existing user has watched: histories[i] is the list of films user i watched. A new user has watched the films in watched.

To recommend films to the new user, look only at the existing users who watched every film in watched (the new user's list is a subset of theirs); skip all other users. For every film that the new user has not watched, count how many of these kept users watched it.

Return the films with a count of at least 1, sorted by count from highest to lowest. Films with the same count are sorted by name in ascending lexicographic order. If there is nothing to recommend, return an empty array.

Function

recommendFilms(histories: String[][], watched: String[]) → String[]

Examples

Example 1

histories = [["a","b","c","d","e"],["a","c","d"],["b","c"]]watched = ["a","c"]return = ["d","b","e"]
  • Users 0 and 1 watched both a and c, so they are kept. User 2 never watched a, so it is skipped.
  • Among the kept users, d was watched by 2 users, and b and e by 1 each.
  • b and e tie, so they are ordered by name: ["d","b","e"].

Example 2

histories = [["x","y"],["y","z"]]watched = []return = ["y","x","z"]
  • The new user watched nothing, so every user is kept.
  • y has 2 viewers; x and z have 1 each and are ordered by name.

Example 3

histories = [["m","n"],["m"]]watched = ["m","q"]return = []
  • No user watched q, so nobody is kept and there is nothing to recommend.

Constraints

  • 1 <= histories.length <= 1000
  • 0 <= histories[i].length <= 50
  • 0 <= watched.length <= 50
  • Every film name is 1 to 10 lowercase English letters or digits.
  • The films in each histories[i] are distinct, and the films in watched are distinct.

More Bloomberg LP Phone Screen questions

  • N-ary Index-Path Encoder and DecoderPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Trapping Rain WaterPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Word SearchOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Fewest Coins CombinationPHONE SCREEN · Seen Nov 2026
  • Track New Values in Sorted OrderPHONE SCREEN · Seen Nov 2026
  • Design Browser HistoryPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Mutable Stock Price Top KPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Sparse Vector and Matrix OperationsPHONE SCREEN · Seen Oct 2026
  • Add Two Numbers IIPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Decode StringPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026

Similar questions at other companies

  • Majority ElementByteDance · PHONE SCREENByteDance interview questions
  • Shared Courses for Every Pair of StudentsCrunchyroll · PHONE SCREENCrunchyroll interview questions
  • Employee Count Median, Mean and ModeClay · PHONE SCREEN
  • Convert an Entry List to a MapEPAM · PHONE SCREENEPAM interview questions
  • Values Exclusive to the Current UserMeta · PHONE SCREENMeta interview questions
  • Count Values Appearing Exactly OnceAgoda · PHONE SCREENAgoda interview questions
  • Top Two Users by Total Purchase AmountSnowflake · PHONE SCREENSnowflake interview questions
  • Restaurant Vote LeadersZipRecruiter · PHONE SCREEN · ONSITE INTERVIEWZipRecruiter interview questions
  • AI Role: Collection with Add and Remove OperationsApple · PHONE SCREENApple interview questions
  • Employees With Shared InterestsPalantir · PHONE SCREENPalantir interview questions

Interview reports that mention this question

  • Bloomberg SWE Phone Screens with Two Teams: 1 Experience

Bloomberg LP interview experiences

  • Bloomberg SWE Phone Screen and Onsite: 1 Experience
  • Bloomberg AI Interview, Hiring Level Not Reported: 2 Experiences
  • Bloomberg Experienced SWE AI Coding Interviews: 2 Experiences
  • Bloomberg New Grad AI-Assisted Coding Rounds: 3 Experiences
  • Bloomberg New Grad SWE AI-Assisted Coding Rounds: 1 Experience
All Bloomberg LP interview questionsSee Bloomberg LP hiring insights
Saved
class Solution {
    public String[] recommendFilms(String[][] histories, String[] watched) {
        // Write your code here.
    }
}
Checking account…