Values Exclusive to the Current User
Problem statement
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^5values.