FastPrepValues Exclusive to the Current User
Problems/Values Exclusive to the Current User

Values Exclusive to the Current User

Meta logoMeta● EasyFULLTIMEPHONE SCREEN
QuestionFunctionExamplesConstraints

Problem statement

Source note: The interview report directly asks for dictionary values held by the current user but by no other user. The judged matrix representation, duplicate handling, and sort order make that seed executable and match it at about 91%.

userValues[i] contains the string values stored for user i. Values may repeat within a user's row.

Return the distinct values owned by currentUser that appear in no other user's row. Return them in ascending lexicographic order.

Function

exclusiveValues(userValues: String[][], currentUser: int) → String[]

Examples

Example 1

userValues = [["red","blue"],["blue","green"],["yellow"]]currentUser = 0return = ["red"]

Blue is shared, while red belongs only to user 0.

Example 2

userValues = [["a","a","b"],["c"]]currentUser = 0return = ["a","b"]

Duplicates within the current user's row do not remove exclusivity or duplicate output.

Example 3

userValues = [["x"],["x"],["x"]]currentUser = 1return = []

The only value is shared by every user.

Constraints

  • 1 <= userValues.length <= 30.
  • 0 <= currentUser < userValues.length.
  • Across all rows there are at most 10^5 values.

More Meta problems

  • Count Events in Rolling Minute WindowsPHONE SCREEN · Seen Oct 2026
  • Valid Word AbbreviationPHONE SCREEN · Seen Oct 2026
  • Shortest Path in a Binary MatrixPHONE SCREEN · Seen Sep 2026
All Meta interview questionsSee Meta hiring insights
Saved
class Solution {
    public String[] exclusiveValues(String[][] userValues, int currentUser) {
        // Write your solution here.
    }
}
Checking account…