FastPrepFind Unmet Users With Shared Interests
Problems/Find Unmet Users With Shared Interests

Find Unmet Users With Shared Interests

Palantir logoPalantir● EasyFULLTIMEONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a Palantir onsite interview. The report names a search function that takes a user ID and the users. It also asks how you would speed up meeting-history lookups, and how you would speed up interest searches while keeping the data as an array.

The report does not give the full rule for what to return. Here, matches share a complete interest name, have not directly met the target, and are not the target. User records become interest lists and meeting pairs. Return indices in order. Interest lookups use arrays.

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

Find users who share an interest with user_id and have not directly met that user. Return their zero-based indices in increasing order.

For this exercise, assume users[i] is the list of interest names for user i. A shared interest means an exact, case-sensitive match of a full name. Duplicate names do not change a match. Exclude user_id itself.

For this exercise, assume each entry [a,b] in meetings records a direct meeting between those two users in either direction. Repeated pairs have no extra effect. Meeting someone who has met the target does not count as meeting the target.

Keep interest lookups array-based, as the follow-up asks. You may sort a copy and use binary search. A separate index for meeting history is allowed. User records are represented here by interest lists and a separate list of meeting pairs.

Function

search(user_id: int, users: String[][], meetings: int[][]) → int[]

Examples

Example 1

user_id = 0users = [["hiking","music"],["music"],["hiking"],["chess"],["music","hiking"]]meetings = [[0,1]]return = [2,4]

User 1 shares music but has already met the target. Users 2 and 4 share an interest and have no direct meeting with user 0. User 3 shares no interest.

Example 2

user_id = 1users = [["Art"],["art"],["art","art"]]meetings = [[2,1]]return = []

User 0 has Art, which differs from art. User 2 has directly met user 1. The target itself is excluded.

Example 3

user_id = 0users = [[]]meetings = []return = []

The target has no interests, and there are no other users.

Constraints

  • 1 <= users.length <= 200.
  • 0 <= user_id < users.length.
  • Each user has 0 to 100 listed interests.
  • Every interest name has 1 to 20 English letters, uppercase or lowercase.
  • 0 <= meetings.length <= 1000.
  • Every meeting entry has exactly two user indices.
  • 0 <= meetings[j][k] < users.length.
  • The total number of interest-name occurrences across all users is at most 1000.

More Palantir interview questions

  • Map and Accumulate Learning QueriesONSITE INTERVIEW · Seen Oct 2026
  • Relational Learning QueriesONSITE INTERVIEW · Seen Apr 2025
  • Maximum Profit with Repeated Stock TradesONSITE INTERVIEW · Seen Sep 2024
  • Minimum Calls for Repeated API LookupsONSITE INTERVIEW · Seen Oct 2022
  • Find Cookable RecipesONSITE INTERVIEW · Seen Nov 2019
  • Simulate Multiplayer WarONSITE INTERVIEW · Seen Nov 2019
  • Trace Terminal Company OwnershipONSITE INTERVIEW · Seen Nov 2019
  • Query Words Within K PositionsPHONE SCREEN · Seen Nov 2026
  • Basic Item DiscountsOA · Seen Nov 2026
  • Optimize Discount Selection Under a Point BudgetOA · Seen Nov 2026

Similar questions at other companies

  • Product Record SearchWells Fargo · OAWells Fargo interview questions
  • Find the Words for Each PrefixDocuSign · PHONE SCREENDocuSign interview questions
  • Filter Anagrams of a TargetMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
  • Deduplicate Logs: Keep FirstGoogle · ONSITE INTERVIEWGoogle interview questions
  • Loyal Customers by Two-Day Product VarietyAmazon · ONSITE INTERVIEW
  • Count Points in Each Boundary IntervalBloomberg LP · ONSITE INTERVIEWBloomberg LP interview questions
  • Type-Ahead Prefix MatchesNavan · ONSITE INTERVIEWNavan interview questions
  • Search a Sorted Array of WordsExpedia · ONSITE INTERVIEWExpedia interview questions
  • 3Sum SmallerSalesforce · ONSITE INTERVIEWSalesforce interview questions
  • Keyboard Autocomplete SuggestionsLyft · ONSITE INTERVIEWLyft interview questions

Interview reports that mention this question

  • Palantir FDSE OA and Interviews: 16 Experiences (Part 1 of 2)

Palantir interview experiences

  • Palantir FDSE Experienced-Hire Interviews: 5 Experiences
  • Palantir FDSE New Grad OA Questions: 6 Experiences (Part 2 of 2)
  • Palantir FDSE New Grad Interviews: 5 Experiences (Part 1 of 2)
  • Palantir FDSE Intern OA and Interviews: 3 Experiences
  • Palantir FDSE Karat and Learning: 7 Experiences (Part 2 of 2)
All Palantir interview questionsSee Palantir hiring insights
Saved
class Solution {
    public int[] search(int user_id, String[][] users, int[][] meetings) {
        return new int[0];
    }
}
Checking account…